123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- var path = require('path')
- var webpack = require('webpack')
- var HtmlWebpackPlugin = require('html-webpack-plugin')
- var isProduction = process.env.NODE_ENV === 'production'
- var config = {
- entry: './demo/demo.js',
- output: {
- path: path.join(__dirname, './demo-dist'),
- filename: 'demo.js'
- },
- module: {
- loaders: [
- {
- test: /\.vue$/,
- loader: 'vue-loader'
- },
- {
- test: /\.css$/,
- loader: 'style-loader!css-loader'
- }
- ]
- },
- externals: {
- vue: 'Vue'
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env':{
- 'NODE_ENV': JSON.stringify('dev')
- }
- }),
- new webpack.optimize.OccurrenceOrderPlugin(),
- new HtmlWebpackPlugin({
- template: 'demo/index.html',
- filename: 'index.html'
- })
- ],
- devServer: {
- contentBase: path.join(__dirname, './demo'),
- compress: false,
- port: 9090
- }
- }
- if (isProduction) {
- config.plugins.push(
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- }
- })
- )
- }
- module.exports = config
|