-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
66 lines (64 loc) · 1.67 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
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: {
app: './example.ts',
vuevendor: [ 'vue', 'vue-property-decorator', 'vue-router', 'vuex' ]
},
output: {
path: __dirname + '/dist',
filename: '[name].js',
// Needed to build dynamic bundles. Use chunkhash to get file hash value
// to prevent e.g. CDN to serve old versions of your bundles.
chunkFilename: '[name].[chunkhash].bundle.js',
// Used to load [name].[chunkhash].bundle.js from a correct location
// publicPath: '/dist/'
},
resolve: {
extensions: ['.ts', '.js', '.tsx']
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'postcss-loader'
]
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
esModule: true
}
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'awesome-typescript-loader',
options: {
useBabel: true,
},
},
},
]
},
plugins: [
// libraries
new webpack.optimize.CommonsChunkPlugin({
name: "vuevendor",
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf("node_modules") !== -1;
}
}),
// Webpack's bootstrap and module manifest.
// Include logic to load correct versions of dynamic bundles.
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest'
})
]
}