-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
112 lines (110 loc) · 2.84 KB
/
webpack.config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const outputPath = path.resolve(__dirname, "out");
const libraryPath = path.resolve(__dirname, "packages/library");
const layoutPath = path.resolve(__dirname, "packages/layout");
const commonPath = path.resolve(__dirname, "packages/common");
const stylePath = path.resolve(__dirname, "packages/style");
const vuejsPath = path.resolve(__dirname, "packages/vuejs");
module.exports = {
mode: "development",
devtool: "cheap-module-eval-source-map",
entry: path.resolve(__dirname, "src/index"),
output: {
path: outputPath,
filename: "[name].js"
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|svg|ico|ttf|eot|woff|woff2)$/i,
use: [
{
loader: "url-loader",
options: {
limit: 1024 * 1024
}
}
]
},
{
test: /\.js$/,
exclude: /(node_modules)/,
use: [
{
loader: "babel-loader"
}
]
},
{
test: /\.(css)$/,
use: [{ loader: MiniCssExtractPlugin.loader }, { loader: "css-loader" }]
},
{
test: /\.s[a|c]ss$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
},
{
test: /\.vue$/,
use: [
{ loader: "vue-loader" },
{
loader: "vue-svg-inline-loader",
options: {
removeAttributes: ["alt", "src", "tabindex"],
svgo: {
plugins: [
{ prefixIds: true },
{ removeViewBox: false },
{
removeAttrs: {
attrs: "(fill|stroke)"
}
}
]
}
}
}
]
}
]
},
resolve: {
alias: {
vue$: "vue/dist/vue.esm.js",
"@library": libraryPath,
"@layout": layoutPath,
"@common": commonPath,
"@vuejs": vuejsPath,
"@style": stylePath
},
extensions: [".js", ".sass", ".scss", ".css", ".vue"]
},
devServer: {
contentBase: path.join(__dirname, "public"),
host: "127.0.0.1",
port: 3000,
progress: true,
inline: true,
hot: false
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebPackPlugin({
template: path.resolve(__dirname, "src/index.html"),
filename: "./index.html"
}),
new MiniCssExtractPlugin({
path: outputPath,
filename: "[name].css"
}),
new CaseSensitivePathsPlugin()
]
};