UNPKG

2.45 kBJavaScriptView Raw
1var path = require('path')
2var webpack = require('webpack')
3
4module.exports = {
5 entry: './resources/main.js',
6 output: {
7 path: path.resolve(__dirname, './dist'),
8 publicPath: '/dist/',
9 filename: 'build.js'
10 },
11 module: {
12 rules: [
13 {
14 test: /\.vue$/,
15 loader: 'vue-loader',
16 options: {
17 loaders: {
18 // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
19 // the "scss" and "sass" values for the lang attribute to the right configs here.
20 // other preprocessors should work out of the box, no loader config like this nessessary.
21 'scss': 'vue-style-loader!css-loader!sass-loader',
22 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
23 }
24 // other vue-loader options go here
25 }
26 },
27 {
28 test: /\.js$/,
29 loader: 'babel-loader',
30 exclude: /node_modules/
31 },
32 {
33 test: /\.scss$/,
34 loaders: ["style-loader", "css-loader", "sass-loader"]
35 },
36 {
37 test: /\.(png|jpg|gif|svg)$/,
38 loader: 'file-loader',
39 options: {
40 name: '[name].[ext]?[hash]'
41 }
42 },
43 {
44 test: /\.md/,
45 use: 'raw-loader'
46 }
47 ]
48 },
49 resolve: {
50 alias: {
51 'vue$': 'vue/dist/vue.common.js'
52 }
53 },
54 devServer: {
55 historyApiFallback: true,
56 noInfo: true
57 },
58 performance: {
59 hints: false
60 },
61 devtool: '#eval-source-map'
62}
63
64if (process.env.NODE_ENV === 'production') {
65 module.exports.devtool = '#source-map'
66 // http://vue-loader.vuejs.org/en/workflow/production.html
67 module.exports.plugins = (module.exports.plugins || []).concat([
68 new webpack.DefinePlugin({
69 'process.env': {
70 NODE_ENV: '"production"'
71 }
72 }),
73 new webpack.optimize.UglifyJsPlugin({
74 sourceMap: true,
75 compress: {
76 warnings: false
77 }
78 }),
79 new webpack.LoaderOptionsPlugin({
80 minimize: true
81 })
82 ])
83}