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 webpack = require("webpack");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
function zip(entries) {
|
||||||
|
const obj = {};
|
||||||
|
for (const [k, v] of entries) {
|
||||||
|
obj[k] = v;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
@ -16,6 +25,7 @@ module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".ts", ".js"],
|
extensions: [".ts", ".js"],
|
||||||
},
|
},
|
||||||
|
externals: zip(fs.readdirSync('node_modules').map(m => [m, `commonjs ${m}`])),
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
|
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue