Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I set webpack proxy in cfg/base.js #347

Open
Anoiing opened this issue Oct 19, 2017 · 0 comments
Open

How can I set webpack proxy in cfg/base.js #347

Anoiing opened this issue Oct 19, 2017 · 0 comments

Comments

@Anoiing
Copy link

Anoiing commented Oct 19, 2017

const path = require('path');
const defaultSettings = require('./defaults');

const additionalPaths = [];
// Remote target
const targetServiceUrl = 'http://xxxxxxxxxxxxxxxxx';

module.exports = {
additionalPaths,
port: defaultSettings.port,
debug: true,
devtool: 'eval',
output: {
path: path.join(__dirname, '/../dist/assets'),
filename: 'app.js',
publicPath: defaultSettings.publicPath,
},
devServer: {
contentBase: './src/',
quiet: false,
proxy: {
'/api/': {
target: targetServiceUrl,
pathRewrite: { '^/api': '' },
secure: false,
},
'/view/
': {
secure: false,
bypass: () => '/index.html',
},
},
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
assets: ${defaultSettings.srcPath}/assets/,
components: ${defaultSettings.srcPath}/components/,
stores: ${defaultSettings.srcPath}/stores/,
utils: ${defaultSettings.srcPath}/utils/,
config: ${defaultSettings.srcPath}/config/${process.env.REACT_WEBPACK_ENV},
'react/lib/ReactMount': 'react-dom/lib/ReactMount',
},
},
module: {},
};

Here is my base.js, but it doesn't work,help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant