Skip to content

Instantly share code, notes, and snippets.

@Phunky
Created March 10, 2016 00:40
Show Gist options
  • Save Phunky/29eea5553ffaee13b496 to your computer and use it in GitHub Desktop.
Save Phunky/29eea5553ffaee13b496 to your computer and use it in GitHub Desktop.
Webpack configs for building my VueJS packages
{
"name": "vue-modal",
"version": "0.0.1",
"description": "Simple modal component",
"main": "dist/vue-modal.js",
"scripts": {
"example": "webpack-dev-server --inline --hot --config build/webpack.example.js --content-base example/",
"dist": "webpack -p --config build/webpack.dist.js"
},
"keywords": [
"vue",
"modal"
],
"author": "Mark Harwood",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.6.5",
"babel-loader": "^6.2.4",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^5.8.35",
"css-loader": "^0.23.1",
"node-sass": "^3.4.2",
"sass-loader": "^3.1.2",
"vue-hot-reload-api": "^1.3.2",
"vue-html-loader": "^1.2.0",
"vue-loader": "^8.2.0",
"vue-style-loader": "^1.0.0",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"vue": "^1.0.17"
}
}
var webpack = require('webpack')
module.exports = {
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
}]
},
babel: {
presets: ['es2015', 'stage-0'],
plugins: ['transform-runtime']
}
}
var webpack = require('webpack')
var config = require('./webpack.base.js')
config.entry = './src/vue-modal.js'
config.output = {
path: './dist',
filename: 'vue-modal.js',
libraryTarget: "umd"
}
config.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
module.exports = config
var webpack = require('webpack')
var config = require('./webpack.base.js')
config.entry = './example/index.js'
config.output = {
path: __dirname,
filename: 'build.js'
}
module.exports = config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment