diff --git a/lib/validate.js b/lib/validate.js index ceaef00a9..240d0f144 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -147,6 +147,11 @@ module.exports = { filename: '[name].js' }; } + + // Default node + if (!this.webpackConfig.node || _.isEmpty(this.webpackConfig.node)) { + this.webpackConfig.node = false; + } // Custom output path if (this.options.out) { diff --git a/tests/validate.test.js b/tests/validate.test.js index df62757e1..96ae11847 100644 --- a/tests/validate.test.js +++ b/tests/validate.test.js @@ -212,6 +212,21 @@ describe('validate', () => { }); }); + describe('default node', () => { + it('should turn NodeStuffPlugin and NodeSourcePlugin plugins off by default', () => { + const testEntry = 'testentry'; + const testConfig = { + entry: testEntry, + }; + const testServicePath = 'testpath'; + module.serverless.config.servicePath = testServicePath; + _.set(module.serverless.service, 'custom.webpack.config', testConfig); + return module + .validate() + .then(() => expect(module.webpackConfig.node).to.eql(false)); + }); + }); + describe('config file load', () => { it('should load a webpack config from file if `custom.webpack` is a string', () => { const testConfig = 'testconfig'; @@ -879,3 +894,4 @@ describe('validate', () => { }); }); }); +