Authored by yyq

pack config

phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs
registry=http://npm.yoho.cn
... ...
const fs = require('fs');
const path = require('path');
const info = {
host: '127.0.0.1',
port: 5002,
publicPath: 'http://127.0.0.1:5002'
};
try {
let dev = JSON.parse(fs.readFileSync(path.join(__dirname, '../../.devhost')));
info.host = dev.host;
info.publicPath = `http://${info.host}:${info.port}/`;
} catch (e) {
console.log(e);
}
module.exports = info;
... ...
... ... @@ -37,7 +37,7 @@ exports.postcssPlugin = (et) => {
return Promise.reject();
},
groupBy(file) {
let dir = _.slice(file.styleFilePath.split('/'), -2);
let dir = _.slice(file.styleFilePath.split(path.sep), -2);
let group = dir[0];
file.retina = true;
... ...
... ... @@ -51,13 +51,6 @@ const cssLoader = (env, type) => {
});
}
if (env === 'dev') {
loaders.unshift({
loader: 'style-loader'
});
return loaders;
}
return ExtractTextPlugin.extract({
fallback: type === 'css' ? 'style-loader' : 'vue-style-loader',
use: loaders
... ...
... ... @@ -3,7 +3,7 @@
const path = require('path');
const _ = require('lodash');
const webpack = require('webpack');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const devInfo = require('./dev-info.js');
let baseConfig = require('./webpack.base.config.js');
... ... @@ -14,20 +14,8 @@ _.mergeWith(baseConfig, {
output: {
publicPath: devInfo.publicPath
},
module: {
rules: [{
enforce: 'pre',
test: /(\.js|\.vue)$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
cache: true,
formatter: require('eslint/lib/formatters/codeframe')
}
}]
},
devServer: {
host: '0.0.0.0',
host: '127.0.0.1',
port: devInfo.port,
publicPath: devInfo.publicPath,
contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')],
... ... @@ -45,10 +33,7 @@ _.mergeWith(baseConfig, {
}
},
plugins: [
new StyleLintPlugin({
files: ['public/scss/**/*.css', 'public/vue/**/*.vue'],
syntax: 'scss'
}),
new ExtractTextPlugin('[name].css'),
new webpack.HotModuleReplacementPlugin()
]
}, function customizer(objValue, srcValue) {
... ...