Skip to content

Commit

Permalink
build: update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
superman66 committed Feb 9, 2018
1 parent 6939e16 commit 0c83a0c
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 287 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@
node_modules/
npm-debug.log
.idea/
dist/
dist/
assets/
272 changes: 0 additions & 272 deletions demo/bundle.js

This file was deleted.

File renamed without changes.
9 changes: 8 additions & 1 deletion package.json
Expand Up @@ -24,13 +24,20 @@
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"cz-conventional-changelog": "^2.1.0",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.30.1",
"node-sass": "^4.5.0",
"sass-loader": "^6.0.1",
"vue-loader": "^10.0.0",
"vue-template-compiler": "^2.1.0",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0",
"webpack-merge": "^2.6.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
6 changes: 5 additions & 1 deletion webpack.config.base.js
@@ -1,5 +1,6 @@
var path = require('path')
var webpack = require('webpack')

var base = {
module: {
rules: [
Expand Down Expand Up @@ -43,7 +44,10 @@ var base = {
performance: {
hints: false
},
devtool: '#eval-source-map'
devtool: '#eval-source-map',
plugins: [

]
};


Expand Down
7 changes: 4 additions & 3 deletions webpack.config.build.js
Expand Up @@ -3,10 +3,10 @@ var webpack = require('webpack')
var base = require('./webpack.config.base')
var merge = require('webpack-merge')


let plugins = [];
if (process.env.NODE_ENV === 'production') {
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
Expand All @@ -32,7 +32,8 @@ var build = merge(base, {
filename: 'vue-highcharts.js',
library: 'VueHighcharts',
libraryTarget: 'umd'
}
},
plugins
})

module.exports = build;
Expand Down
33 changes: 24 additions & 9 deletions webpack.config.js
Expand Up @@ -2,17 +2,32 @@ var path = require('path')
var webpack = require('webpack')
var base = require('./webpack.config.base')
var merge = require('webpack-merge')
const HtmlwebpackPlugin = require('html-webpack-plugin')

let plugins = []
plugins.push(
new HtmlwebpackPlugin({
title: 'Vue-Highcharts',
filename: 'index.html',
template: 'demo/index.html',
inject: true,
hash: true,
path: path.resolve(__dirname, 'assets'),
}),
)
var demo = merge(base, {
entry: './demo/main.js',
entry: path.resolve(__dirname, 'demo/index'),
devServer: {
hot: true,
contentBase: path.resolve(__dirname, ''),
publicPath: '/'
},
output: {
path: path.resolve(__dirname, './demo'),
publicPath: '/demo/',
filename: 'bundle.js'
path: path.resolve(__dirname, 'assets'),
filename: 'bundle.js',
publicPath: './',
},
plugins,
})

});

module.exports = demo;


module.exports = demo

0 comments on commit 0c83a0c

Please sign in to comment.