Skip to content

Commit ec73a04

Browse files
committed
Update: Use patterns in webpack copy configuration
1 parent 4aee331 commit ec73a04

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

webpack.config.js

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ const config = {
1313
entry: path.join(__dirname, 'src', 'main.js'),
1414
mode: env,
1515
output: {
16-
publicPath: ''
16+
publicPath: '',
1717
},
1818
serve: {
1919
host: 'localhost',
20-
port: 3000
20+
port: 3000,
2121
},
2222
optimization: {
2323
splitChunks: {
24-
chunks: 'all'
25-
}
24+
chunks: 'all',
25+
},
2626
},
2727
devtool: sourceMap ? 'cheap-module-eval-source-map' : undefined,
2828
module: {
2929
rules: [
3030
{
3131
test: /\.vue$/,
32-
loader: 'vue-loader'
32+
loader: 'vue-loader',
3333
},
3434
{
3535
test: /\.js$/,
3636
loader: 'babel-loader',
37-
include: [path.join(__dirname, 'src')]
37+
include: [path.join(__dirname, 'src')],
3838
},
3939
{
4040
test: /\.scss$/,
41-
loader: 'vue-style-loader!css-loader!resolve-url-loader!sass-loader'
41+
loader: 'vue-style-loader!css-loader!resolve-url-loader!sass-loader',
4242
},
4343
{
4444
test: /\.(png|jp(e*)g|svg|ico)$/,
@@ -47,23 +47,23 @@ const config = {
4747
loader: 'url-loader',
4848
options: {
4949
limit: 1,
50-
name: 'images/[hash]-[name].[ext]'
51-
}
52-
}
53-
]
50+
name: 'images/[hash]-[name].[ext]',
51+
},
52+
},
53+
],
5454
},
5555
{
5656
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
5757
use: [
5858
{
5959
loader: 'file-loader',
6060
options: {
61-
name: 'fonts/[name].[ext]'
62-
}
63-
}
64-
]
65-
}
66-
]
61+
name: 'fonts/[name].[ext]',
62+
},
63+
},
64+
],
65+
},
66+
],
6767
},
6868
plugins: [
6969
new VueLoaderPlugin(),
@@ -75,17 +75,19 @@ const config = {
7575
? {
7676
removeComments: true,
7777
collapseWhitespace: true,
78-
removeAttributeQuotes: true
78+
removeAttributeQuotes: true,
7979
}
80-
: false
80+
: false,
81+
}),
82+
new CopyWebpackPlugin({
83+
patterns: [
84+
{
85+
from: path.join(__dirname, 'static', 'assets', '*'),
86+
to: path.join(__dirname, 'dist', 'assets'),
87+
flatten: true,
88+
},
89+
],
8190
}),
82-
new CopyWebpackPlugin([
83-
{
84-
from: path.join(__dirname, 'static', 'assets', '*'),
85-
to: path.join(__dirname, 'dist', 'assets'),
86-
flatten: true
87-
}
88-
])
8991
],
9092
resolve: {
9193
alias: {
@@ -96,17 +98,17 @@ const config = {
9698
'@MasterStyle$': path.resolve(__dirname, 'src/scss/master.scss'),
9799
'@Asset': path.resolve(__dirname, 'src/assets/'),
98100
'@Test': path.resolve(__dirname, '__test__'),
99-
'@': path.resolve(__dirname, 'src/')
100-
}
101-
}
101+
'@': path.resolve(__dirname, 'src/'),
102+
},
103+
},
102104
};
103105

104106
if (minify) {
105107
config.optimization.minimizer = [
106108
new UglifyJsPlugin({
107109
cache: true,
108-
parallel: true
109-
})
110+
parallel: true,
111+
}),
110112
];
111113
}
112114

0 commit comments

Comments
 (0)