-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
37 lines (33 loc) · 1.14 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const framworkConfig = framework =>
require(`./build-utils/presets/webpack.${framework}`)(framework)
const pluginConfig = build =>
require(`./build-utils/plugins/webpack.${build}`)(build)
// const webpack = require("webpack")
const webpackMerge = require("webpack-merge")
const { getIfUtils } = require("webpack-config-utils")
const path = require("path")
module.exports = (env = { mode: "development" }) => {
const { ifDevelopment } = getIfUtils(env.mode)
const basicConfig = {
context: path.join(__dirname, "src"),
entry: "./index.js",
output: {
path: path.join(__dirname, "dist"),
filename: "index.js",
// publicPath: ifDevelopment("dist/", path.join(__dirname, "dist")),
chunkFilename: ifDevelopment(
"[name].[hash].chunk.js",
"[name].[chunkhash].bundle.js"
)
},
devServer: {
contentBase: "./dist"
},
mode: (env && env.mode) || "none"
}
const jsConfig = framworkConfig("javascript")
const vueConfig = framworkConfig("vue")
const buildConfig = pluginConfig("build")
const config = webpackMerge(basicConfig, jsConfig, vueConfig, buildConfig)
return config
}