Commit 4fa7588e by 万亚飞

config

parent ee786471
...@@ -104,7 +104,7 @@ module.exports = merge(base, { ...@@ -104,7 +104,7 @@ module.exports = merge(base, {
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env 'process.env': JSON.stringify(env)
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: resolveRoot('index.html') template: resolveRoot('index.html')
......
...@@ -13,7 +13,7 @@ const merge = require('webpack-merge'); ...@@ -13,7 +13,7 @@ const merge = require('webpack-merge');
const base = require('./webpack.base.js'); const base = require('./webpack.base.js');
const env = require(`../config/${process.env.ENV_MARK}.env`); const env = require(`../config/${process.env.ENV_MARK}.env`);
console.log('env', env.NODE_ENV);
const os = require('os'); const os = require('os');
function resolveRoot(dir) { function resolveRoot(dir) {
return path.join(__dirname, '..', dir); return path.join(__dirname, '..', dir);
...@@ -147,7 +147,7 @@ module.exports = merge(base, { ...@@ -147,7 +147,7 @@ module.exports = merge(base, {
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env 'process.env': JSON.stringify(env)
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: resolveRoot('index.html'), template: resolveRoot('index.html'),
......
//开发环境 //开发环境
module.exports = { module.exports = {
NODE_ENV: '"development"', NODE_ENV: 'development',
ENV_MARK: '"development"', ENV_MARK: 'development',
prefix: '"https://testapi.ydl.com/api"', prefix: 'https://testapi.ydl.com/api',
prefixH2: '"https//testh2.yidianling.com"' prefixH2: 'https//testh2.yidianling.com'
}; };
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: 'production',
ENV_MARK: '"production"', ENV_MARK: 'production',
prefix: '"https://api.ydl.com/api"', prefix: 'https://api.ydl.com/api',
prefixH2: '"https://h2.yidianling.com"' prefixH2: 'https://h2.yidianling.com'
}; };
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: 'production',
ENV_MARK: '"testing"', ENV_MARK: 'testing',
prefix: '"https://testapi.ydl.com/api"', prefix: 'https://testapi.ydl.com/api',
prefixH2: '"https//testh2.yidianling.com"' prefixH2: 'https//testh2.yidianling.com'
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment