Skip to content

Instantly share code, notes, and snippets.

@eddyekofo94
Created May 21, 2017 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyekofo94/bd7e2a2b2cf66c94eeed2bb89e7934e0 to your computer and use it in GitHub Desktop.
Save eddyekofo94/bd7e2a2b2cf66c94eeed2bb89e7934e0 to your computer and use it in GitHub Desktop.
My Vuejs Webpack2 configuration
{
"name": "pyramid_vue",
"version": "1.0.0",
"description": "a Vuejs project",
"main": "index.js",
"scripts": {
"dev": "webpack --watch",
"build": "webpack --progress --hide-modules"
},
"repository": "",
"keywords": [
"Vuejs",
"Pyramid",
"babel",
"python",
"javascript",
"webpack"
],
"author": "Eddy Ekofo",
"license": "MIT",
"bugs": {
"url": ""
},
"homepage": "",
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.23.0",
"css-loader": "^0.28.1",
"file-loader": "^0.11.1",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.5",
"style-loader": "^0.17.0",
"vue-html-loader": "^1.2.4",
"vue-loader": "^12.1.0",
"vue-resource": "^1.3.1",
"vue-router": "^2.5.3",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"vuex": "^2.3.1",
"webpack": "^2.5.1"
},
"dependencies": {
"vue": "^2.3.3",
"yarn": "^0.24.4"
}
}
module.exports = {
// This is the "main" file which should include all other modules
entry: __dirname + '/static/index.js',
// Where should the compiled file go?
output: {
path: __dirname + '/static/dist',
publicPath: '/static/dist/',
filename: 'build.js'
},
module: {
// Special compilation rules
loaders: [
{
// Ask webpack to check: If this file ends with .js, then apply some transforms
test: /\.js$/,
// Transform it with babel
loader: 'babel-loader',
// don't transform node_modules folder (which don't need to be compiled)
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this nessessary.
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment