|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- var path = require('path');
- var webpack = require('webpack');
-
- module.exports = {
- entry: './src/main.js',
- output: {
- path: path.resolve(__dirname, './dist'),
- publicPath: '/dist/',
- filename: 'build.js'
- },
- resolve: {
- extensions: ['', '.js', '.vue'],
- fallback: [path.join(__dirname, 'node_modules')],
- alias: {
- src: path.resolve(__dirname, './src')
- }
- },
- resolveLoader: {
- root: path.join(__dirname, 'node_modules')
- },
- module: {
- loaders: [
- {
- test: /\.vue$/,
- loader: 'vue'
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- exclude: /node_modules/
- },
- {
- test: /\.json$/,
- loader: 'json-loader'
- },
- {
- test: /\.html$/,
- loader: 'vue-html'
- },
- {
- test: /\.(png|jpg|gif|svg|woff2?|eot|ttf)(\?.*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: '[name].[ext]?[hash]'
- }
- }
- ]
- },
- plugins: [
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- 'window.jQuery': 'jquery'
- })
- ],
- devServer: {
- historyApiFallback: true,
- noInfo: true
- },
- devtool: '#eval-source-map'
- };
-
- if (process.env.NODE_ENV === 'production') {
- module.exports.devtool = '#source-map';
- // http://vuejs.github.io/vue-loader/workflow/production.html
- module.exports.plugins = (module.exports.plugins || []).concat([
- new webpack.DefinePlugin({
- 'process.env': {
- NODE_ENV: '"production"'
- }
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- }
- }),
- new webpack.optimize.OccurenceOrderPlugin()
- ]);
- }
|