webpack: Do not bundle node_modules/ in dev mode
This commit is contained in:
parent
28db241ac7
commit
7aef97334b
1 changed files with 10 additions and 0 deletions
|
@ -1,7 +1,16 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
|
||||
function zip(entries) {
|
||||
const obj = {};
|
||||
for (const [k, v] of entries) {
|
||||
obj[k] = v;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
mode: 'development',
|
||||
|
@ -16,6 +25,7 @@ module.exports = {
|
|||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
externals: zip(fs.readdirSync('node_modules').map(m => [m, `commonjs ${m}`])),
|
||||
plugins: [
|
||||
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue