mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
feat(webpack): allow watching node_modules (#9781)
This commit is contained in:
@ -636,3 +636,9 @@ exports[`base configuration for ios 1`] = `
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`base configuration support env.watchNodeModules 1`] = `
|
||||
Object {
|
||||
"managedPaths": Array [],
|
||||
}
|
||||
`;
|
||||
|
@ -22,6 +22,14 @@ describe('base configuration', () => {
|
||||
});
|
||||
}
|
||||
|
||||
it('support env.watchNodeModules', () => {
|
||||
init({
|
||||
ios: true,
|
||||
watchNodeModules: true,
|
||||
});
|
||||
expect(base(new Config()).get('snapshot')).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('supports dotenv', () => {
|
||||
const fsSpy = jest.spyOn(fs, 'existsSync');
|
||||
fsSpy.mockReturnValue(true);
|
||||
|
@ -124,6 +124,13 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
],
|
||||
});
|
||||
|
||||
// allow watching node_modules
|
||||
config.when(env.watchNodeModules, (config) => {
|
||||
config.set('snapshot', {
|
||||
managedPaths: [],
|
||||
});
|
||||
});
|
||||
|
||||
// Set up Terser options
|
||||
config.optimization.minimizer('TerserPlugin').use(TerserPlugin, [
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ export interface IWebpackEnv {
|
||||
|
||||
// misc
|
||||
replace?: string[] | string;
|
||||
watchNodeModules?: boolean;
|
||||
}
|
||||
|
||||
interface IChainEntry {
|
||||
|
Reference in New Issue
Block a user