Last active
September 27, 2020 14:51
-
-
Save amitsingh-007/466bfdbc6f08326bde3dcc0c79b9f4aa to your computer and use it in GitHub Desktop.
Legacy Webpack config for ES5 code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const legacyBabelConfig = require("babel.legacy.config.js"); | |
module.exports = { | |
context: path.resolve(__dirname, "src"), | |
resolve: { | |
extensions: [".js", ".jsx"], | |
alias: {...}, | |
modules: [ | |
path.resolve(__dirname, "src"), | |
path.resolve(__dirname, "node_modules"), | |
], | |
}, | |
node: {...}, | |
stats: {...}, | |
watchOptions: {...}, | |
entry: { | |
main: path.resolve(__dirname, "src/client/index.js"), | |
}, | |
output: { | |
path: path.resolve(__dirname, "client-build-legacy"), | |
filename: "js/[name].[chunkhash:9].es5.js", | |
chunkFilename: "js/[name].[chunkhash:9].es5.js", | |
}, | |
name: "legacy-build", | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?/, | |
include: path.resolve(__dirname, "src"), | |
use: [ | |
{ | |
loader: "babel-loader", | |
options: Object.assign(legacyBabelConfig(), { | |
cacheDirectory: true, | |
cacheCompression: false, | |
}), | |
}, | |
//...other loaders | |
], | |
}, | |
// css configs, | |
], | |
}, | |
optimization: {...}, | |
plugins: [ | |
// ...other loaders | |
new LoadablePlugin({ filename: "legacy-loadable-stats.json" }), | |
], | |
devtool: "source-map", | |
mode: "production", | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment