Guest User

Untitled

a guest
May 11th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var path = require('path')
  2. var webpack = require('webpack')
  3.  
  4. module.exports = {
  5.   entry: './src/main.js',
  6.   output: {
  7.     path: path.resolve(__dirname, './dist'),
  8.     publicPath: '/dist/',
  9.     filename: 'build.js'
  10.   },
  11.   module: {
  12.     loaders: [
  13.         {
  14.             test:   /\.scss$/,
  15.             loader: "style-loader!css-loader!postcss-loader!sass"
  16.         }
  17.     ],
  18.     rules: [
  19.       {
  20.         test: /\.vue$/,
  21.         loader: 'vue-loader',
  22.         options: {
  23.           loaders: {
  24.           }
  25.           // other vue-loader options go here
  26.         }
  27.       },
  28.       {
  29.         test: /\.js$/,
  30.         loader: 'babel-loader',
  31.         exclude: /node_modules/
  32.       },
  33.       {
  34.         test: /\.(png|jpg|gif|svg)$/,
  35.         loader: 'file-loader',
  36.         options: {
  37.           name: '[name].[ext]?[hash]'
  38.         }
  39.       },
  40.       {
  41.         test: /\.(scss|sass)$/,
  42.         use: [
  43.             {
  44.                 loader: "style-loader" // creates style nodes from JS strings
  45.             },
  46.             {
  47.                 loader: "css-loader", // translates CSS into CommonJS
  48.                 options: cssLoaderOptions
  49.             },
  50.             {
  51.                 loader: "sass-loader", // compiles Sass to CSS
  52.                 options: {
  53.                     sourceMap: useSourcemaps,
  54.                     sourceMapContents: true
  55.                 }
  56.             }
  57.         ]
  58.     },
  59.     ]
  60.   },
  61.   resolve: {
  62.     alias: {
  63.       'vue$': 'vue/dist/vue.esm.js'
  64.     }
  65.   },
  66.   devServer: {
  67.     historyApiFallback: true,
  68.     noInfo: true
  69.   },
  70.   performance: {
  71.     hints: false
  72.   },
  73.   devtool: '#eval-source-map'
  74. }
  75.  
  76. if (process.env.NODE_ENV === 'production') {
  77.   module.exports.devtool = '#source-map'
  78.   // http://vue-loader.vuejs.org/en/workflow/production.html
  79.   module.exports.plugins = (module.exports.plugins || []).concat([
  80.     new webpack.DefinePlugin({
  81.       'process.env': {
  82.         NODE_ENV: '"production"'
  83.       }
  84.     }),
  85.     new webpack.optimize.UglifyJsPlugin({
  86.       sourceMap: true,
  87.       compress: {
  88.         warnings: false
  89.       }
  90.     }),
  91.     new webpack.LoaderOptionsPlugin({
  92.       minimize: true
  93.     })
  94.   ])
  95. }
Advertisement
Add Comment
Please, Sign In to add comment