mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(webpack): exclude files starting with _ from require.context (#9596)
This commit is contained in:
@ -4,6 +4,7 @@ import { getEntryPath, getEntryDirPath } from '../helpers/platform';
|
||||
import { addVirtualEntry } from '../helpers/virtualModules';
|
||||
import { chainedSetAddAfter } from '../helpers/chain';
|
||||
import { env as _env, IWebpackEnv } from '../index';
|
||||
import { ContextExclusionPlugin } from 'webpack';
|
||||
import base from './base';
|
||||
|
||||
export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
@ -22,6 +23,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
`
|
||||
);
|
||||
|
||||
// exclude files starting with _ from require.context
|
||||
config
|
||||
.plugin(`ContextExclusionPlugin|exclude_files`)
|
||||
.use(ContextExclusionPlugin, [/\b_.+\./]);
|
||||
|
||||
chainedSetAddAfter(
|
||||
config.entry('bundle'),
|
||||
'@nativescript/core/globals/index.js',
|
||||
|
@ -4,6 +4,7 @@ import { getEntryDirPath, getEntryPath } from '../helpers/platform';
|
||||
import { addVirtualEntry } from '../helpers/virtualModules';
|
||||
import { chainedSetAddAfter } from '../helpers/chain';
|
||||
import { env as _env, IWebpackEnv } from '../index';
|
||||
import { ContextExclusionPlugin } from 'webpack';
|
||||
import base from './base';
|
||||
|
||||
export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
@ -22,6 +23,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
`
|
||||
);
|
||||
|
||||
// exclude files starting with _ from require.context
|
||||
config
|
||||
.plugin(`ContextExclusionPlugin|exclude_files`)
|
||||
.use(ContextExclusionPlugin, [/\b_.+\./]);
|
||||
|
||||
chainedSetAddAfter(
|
||||
config.entry('bundle'),
|
||||
'@nativescript/core/globals/index.js',
|
||||
|
Reference in New Issue
Block a user