Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 16 additions & 0 deletions tests/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -879,3 +894,4 @@ describe('validate', () => {
});
});
});