Skip to content

Instantly share code, notes, and snippets.

@freedomlang
Created May 28, 2017 15:53
Show Gist options
  • Save freedomlang/bd064d1f8e461ff19f3839d3d76b7ec4 to your computer and use it in GitHub Desktop.
Save freedomlang/bd064d1f8e461ff19f3839d3d76b7ec4 to your computer and use it in GitHub Desktop.
settings for webpack-dashboard's error
{
"root": true,
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
extends: "airbnb-base",
rules: {
},
}
{
"name": "frontend",
"description": "A Vue.js project",
"version": "1.0.0",
"author": "freedomlang <[email protected]>",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --config dev.config.js",
"build": "webpack --config prod.config.js --progress",
"lib": "webpack --config dll.config.js --progress"
},
"dependencies": {
"add-asset-html-webpack-plugin": "^1.0.2",
"animate.css": "^3.5.2",
"axios": "^0.15.3",
"babel-eslint": "^7.2.3",
"babel-plugin-component": "^0.9.1",
"echarts": "^3.6.0",
"eslint": "^3.19.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "2.2.0",
"extract-text-webpack-plugin": "2.x",
"file-loader": "^0.11.1",
"happypack": "^3.0.3",
"highcharts": "^5.0.9",
"html-webpack-plugin": "^2.28.0",
"jsonp": "^0.2.1",
"lodash": "^4.17.4",
"resolve-url-loader": "^2.0.2",
"style-loader": "^0.14.1",
"terraformer-arcgis-parser": "^1.0.5",
"tween.js": "^16.6.0",
"vue": "^2.2.1",
"vue-carousel-3d": "^0.1.8",
"vuex": "^2.2.1",
"webpack-bundle-size-analyzer": "^2.6.0",
"webpack-dashboard": "^0.4.0",
"webpack-merge": "^4.1.0",
"webpack-uglify-parallel": "^0.1.3"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-latest": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.2.0",
"node-sass": "^4.5.0",
"sass-loader": "^5.0.1",
"vue-loader": "^11.1.4",
"vue-template-compiler": "^2.2.1",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0"
},
"preferGlobal": true
}
var path = require('path');
var webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '',
filename: 'build.js'
},
module: {
rules: [{
test: /\.vue$/, // only process vue files by the loaders below
loader: 'vue-loader',
include: [
path.resolve(__dirname, "src")
],
exclude: path.resolve(__dirname, "src/assets"),
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 necessary.
'scss': {
loader: 'vue-style-loader!css-loader!resolve-url-loader!sass-loader'
}
}
}
}, {
test: /\.js$/,
include: [
path.resolve(__dirname, "src")
],
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/
}, {
enforce: "pre",
test: /\.js$/,
include: [
path.resolve(__dirname, "src")
],
loader: 'eslint-loader',
exclude: /(node_modules|bower_components)/
}, {
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
}, {
test: /\.(png|jpg|gif|svg)$/, // only process .png .jpg .gif .svg files by using the loaders below
loader: 'file-loader',
options: {
name: 'imgs/[name].[hash].[ext]', // assign the path for image used [指定被加载器加载后的图像的位置]
}
}, {
test: /\.css$/, // Only process .css files by using the loaders below [以下加载器只处理css文件]
// loader: 'happypack/loader?id=css' // Run both loaders
loader: 'style-loader!css-loader' // Run both loaders
}]
},
resolve: {
modules: [
"node_modules",
],
extensions: [".js", ".jsx"],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'js': path.resolve(__dirname, './src/assets/js'),
'img': path.resolve(__dirname, './src/assets/img'),
'else': path.resolve(__dirname, './src/assets/else'),
'style': path.resolve(__dirname, './src/assets/stylesheets'),
'bootstrap': path.resolve(__dirname, './src/assets/stylesheets/bootstrap')
}
},
devServer: {
historyApiFallback: true,
noInfo: true,
inline: true,
hot: true, // hot reload for vue
host: '0.0.0.0', // allow access from any ip
quiet: true
},
performance: {
hints: false
},
plugins: [
// generate the index.html according to the template
new HtmlWebpackPlugin({
filename: 'index.html',
template: './myIndex.ejs'
}),
// insert specific file to html
new AddAssetHtmlPlugin([{
filepath: require.resolve('./libs/lib.js'),
includeSourcemap: false
}, {
filepath: require.resolve('./src/assets/js/cctvVideoCtrl.js'),
includeSourcemap: false
}, ]),
// add static resources from the generated json
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./manifest.json')
// name:'lib'
}),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment