Skip to content

Commit

Permalink
build: update
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jun 23, 2018
1 parent 1b01359 commit 7f70f1a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 123 deletions.
7 changes: 3 additions & 4 deletions .babelrc
@@ -1,9 +1,8 @@
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "ie >= 9"]
}
}]
"modules": false
}],
"stage-0"
]
}
2 changes: 2 additions & 0 deletions .browserslistrc
@@ -0,0 +1,2 @@
last 2 versions
ie >= 10
6 changes: 3 additions & 3 deletions .eslintrc
Expand Up @@ -7,8 +7,8 @@
"html"
],
"rules": {
"no-alert": 0,
"no-new": 0,
"no-param-reassign": 0
"no-alert": "off",
"no-new": "off",
"no-param-reassign": "off"
}
}
18 changes: 1 addition & 17 deletions .gitattributes
@@ -1,18 +1,2 @@
# Automatically normalize line endings for all text-based files
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
# Auto detect text files and perform LF normalization
* text=auto

# For the following file types, normalize line endings to LF on
# checkin and prevent conversion to CRLF when they are checked out
# (this is required in order to prevent newline related issues like,
# for example, after the build script is run)
.* text eol=lf
*.css text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.vue text eol=lf
*.xml text eol=lf
48 changes: 1 addition & 47 deletions .gitignore
@@ -1,48 +1,2 @@
# Project
node_modules
npm-debug.log
*.map

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
node_modules
14 changes: 10 additions & 4 deletions postcss.config.js
@@ -1,6 +1,12 @@
module.exports = {
plugins: [
require('postcss-smart-import')(),
require('postcss-cssnext')(),
],
plugins: {
'postcss-import': {},
'postcss-preset-env': {
stage: 3,
features: {
'nesting-rules': true,
},
},
cssnano: {},
},
};
57 changes: 9 additions & 48 deletions webpack.config.js
@@ -1,15 +1,11 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const path = require('path');
const ip = require('ip');

const IS_PRODUCTION = process.env.NODE_ENV === 'production';

module.exports = {
module.exports = (env = {}) => ({
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: 'dist/',
filename: 'app.js',
},
module: {
rules: [
Expand All @@ -20,7 +16,7 @@ module.exports = {
{
test: /\.css$/,
use: [
'style-loader',
'vue-style-loader',
{
loader: 'css-loader',
options: {
Expand All @@ -35,48 +31,13 @@ module.exports = {
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
},
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: IS_PRODUCTION ? '"production"' : '"development"',
},
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: env.production ? '../index.html' : 'index.html',
template: './src/index.html',
}),
],
devServer: {
host: ip.address(),
stats: {
colors: true,
chunks: false,
},
},
performance: {
hints: false,
},
devtool: '#eval-source-map',
};

if (IS_PRODUCTION) {
module.exports.devtool = false;

// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false,
},
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
}),
]);
}
});

0 comments on commit 7f70f1a

Please sign in to comment.