Skip to content

Commit

Permalink
target node exclude client scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sanonz committed Oct 24, 2018
1 parent fa96a76 commit 01f2413
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils/addEntries.js
Expand Up @@ -47,7 +47,9 @@ function addEntries (config, options, server) {
};

[].concat(config).forEach((config) => {
config.entry = prependEntry(config.entry || './src');
if (['node', 'async-node'].indexOf(config.target) === -1) {
config.entry = prependEntry(config.entry || './src');
}
});
}
}
Expand Down
15 changes: 15 additions & 0 deletions test/Entry.test.js
Expand Up @@ -174,4 +174,19 @@ describe('Entry', () => {
);
assert.equal(hotClientScript, require.resolve(hotClientScript));
});

it('add node target', () => {
const webpackOptions = Object.assign({}, config, {
entry: {
foo: './foo.js'
},
node: true,
target: 'node'
});
const devServerOptions = {};

addEntries(webpackOptions, devServerOptions);

assert.equal(webpackOptions.entry.foo[0].indexOf('client/?'), -1);
});
});

0 comments on commit 01f2413

Please sign in to comment.