webpack: Add a configuration for production bundle
This commit is contained in:
parent
7aef97334b
commit
4dcc561a73
2 changed files with 31 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"watch": "webpack --watch --config webpack.dev.js",
|
||||
"prepare": "webpack --config webpack.dev.js",
|
||||
"prepare": "webpack --config webpack.prod.js",
|
||||
"test": "node lib/bin/bolt-test.js compare",
|
||||
"generate-ast": "tsastgen src/ast-spec.ts:src/ast.ts",
|
||||
"update-lkg": "node lib/bin/bolt-test.js create-snapshot lkg"
|
||||
|
|
30
webpack.prod.js
Normal file
30
webpack.prod.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
mode: 'development',
|
||||
entry: {
|
||||
'bolt': './src/bin/bolt.ts',
|
||||
'bolt-test': './src/bin/bolt-test.ts',
|
||||
},
|
||||
output: {
|
||||
filename: 'bin/[name].js',
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
|
||||
],
|
||||
devtool: 'source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts$/, loader: "ts-loader", options: { transpileOnly: true } },
|
||||
{ test: /\.m?js$/, exclude: /node_modules/, loader: 'babel-loader' },
|
||||
]
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in a new issue