From 9adada30674717ca76431dea10501606b38ab46f Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 28 Jun 2017 19:09:32 +0100 Subject: [PATCH] Simplify build files --- _assets/build/build.js | 2 +- _assets/{config/index.js => build/config.js} | 8 ++++++-- _assets/build/dev.js | 2 +- _assets/build/utils.js | 2 +- _assets/build/vue-loader.conf.js | 2 +- _assets/build/webpack.base.conf.js | 2 +- _assets/build/webpack.dev.conf.js | 2 +- _assets/config/dev.env.js | 6 ------ _assets/config/prod.env.js | 3 --- 9 files changed, 12 insertions(+), 17 deletions(-) rename _assets/{config/index.js => build/config.js} (92%) delete mode 100644 _assets/config/dev.env.js delete mode 100644 _assets/config/prod.env.js diff --git a/_assets/build/build.js b/_assets/build/build.js index 6b8add10..7588bd93 100644 --- a/_assets/build/build.js +++ b/_assets/build/build.js @@ -7,7 +7,7 @@ var rm = require('rimraf') var path = require('path') var chalk = require('chalk') var webpack = require('webpack') -var config = require('../config') +var config = require('./config') var webpackConfig = require('./webpack.prod.conf') var spinner = ora('building for production...') diff --git a/_assets/config/index.js b/_assets/build/config.js similarity index 92% rename from _assets/config/index.js rename to _assets/build/config.js index a313c610..cc26c4b6 100644 --- a/_assets/config/index.js +++ b/_assets/build/config.js @@ -3,7 +3,9 @@ var path = require('path') module.exports = { build: { - env: require('./prod.env'), + env: { + NODE_ENV: '"production"' + }, index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', @@ -22,7 +24,9 @@ module.exports = { bundleAnalyzerReport: process.env.npm_config_report }, dev: { - env: require('./dev.env'), + env: { + NODE_ENV: '"development"' + }, index: path.resolve(__dirname, '../dist_dev/templates/index.html'), assetsRoot: path.resolve(__dirname, '../dist_dev/'), assetsSubDirectory: '_', diff --git a/_assets/build/dev.js b/_assets/build/dev.js index 4e97d482..8532c366 100644 --- a/_assets/build/dev.js +++ b/_assets/build/dev.js @@ -6,7 +6,7 @@ var rm = require('rimraf') var path = require('path') var chalk = require('chalk') var webpack = require('webpack') -var config = require('../config') +var config = require('./config') var webpackConfig = require('./webpack.dev.conf') rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { diff --git a/_assets/build/utils.js b/_assets/build/utils.js index b1d54b4d..d078ded4 100644 --- a/_assets/build/utils.js +++ b/_assets/build/utils.js @@ -1,5 +1,5 @@ var path = require('path') -var config = require('../config') +var config = require('./config') var ExtractTextPlugin = require('extract-text-webpack-plugin') exports.assetsPath = function (_path) { diff --git a/_assets/build/vue-loader.conf.js b/_assets/build/vue-loader.conf.js index 7aee79ba..03dde95e 100644 --- a/_assets/build/vue-loader.conf.js +++ b/_assets/build/vue-loader.conf.js @@ -1,5 +1,5 @@ var utils = require('./utils') -var config = require('../config') +var config = require('./config') var isProduction = process.env.NODE_ENV === 'production' module.exports = { diff --git a/_assets/build/webpack.base.conf.js b/_assets/build/webpack.base.conf.js index 1a93f4a8..433e0aaf 100644 --- a/_assets/build/webpack.base.conf.js +++ b/_assets/build/webpack.base.conf.js @@ -1,6 +1,6 @@ var path = require('path') var utils = require('./utils') -var config = require('../config') +var config = require('./config') var vueLoaderConfig = require('./vue-loader.conf') function resolve (dir) { diff --git a/_assets/build/webpack.dev.conf.js b/_assets/build/webpack.dev.conf.js index c3db2340..4dc74df6 100644 --- a/_assets/build/webpack.dev.conf.js +++ b/_assets/build/webpack.dev.conf.js @@ -2,7 +2,7 @@ var fs = require('fs') var path = require('path') var utils = require('./utils') var webpack = require('webpack') -var config = require('../config') +var config = require('./config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var CopyWebpackPlugin = require('copy-webpack-plugin') diff --git a/_assets/config/dev.env.js b/_assets/config/dev.env.js deleted file mode 100644 index efead7c8..00000000 --- a/_assets/config/dev.env.js +++ /dev/null @@ -1,6 +0,0 @@ -var merge = require('webpack-merge') -var prodEnv = require('./prod.env') - -module.exports = merge(prodEnv, { - NODE_ENV: '"development"' -}) diff --git a/_assets/config/prod.env.js b/_assets/config/prod.env.js deleted file mode 100644 index 773d263d..00000000 --- a/_assets/config/prod.env.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - NODE_ENV: '"production"' -}