build: add fetch polyfill and optimize chunk split
This commit is contained in:
parent
9d81f9c045
commit
de9655fd99
2 changed files with 15 additions and 9 deletions
|
@ -63,12 +63,14 @@ class APIConfig extends Component {
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
name="hostname"
|
name="hostname"
|
||||||
|
placeholder="Hostname"
|
||||||
value={hostname}
|
value={hostname}
|
||||||
onChange={this.handleInputOnChange}
|
onChange={this.handleInputOnChange}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
name="port"
|
name="port"
|
||||||
|
placeholder="Port"
|
||||||
value={port}
|
value={port}
|
||||||
onChange={this.handleInputOnChange}
|
onChange={this.handleInputOnChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -22,7 +22,7 @@ const svgSpriteRule = {
|
||||||
// ---- entry
|
// ---- entry
|
||||||
|
|
||||||
const entry = {
|
const entry = {
|
||||||
app: ['@babel/polyfill', './src/app.js']
|
app: ['whatwg-fetch', '@babel/polyfill', './src/app.js']
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---- output
|
// ---- output
|
||||||
|
@ -33,10 +33,7 @@ const output = {
|
||||||
publicPath: ''
|
publicPath: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// const polyfill = ['whatwg-fetch'];
|
// const vendor = ['redux', 'react', 'react-dom', 'react-router-dom'];
|
||||||
// entry.polyfill = polyfill;
|
|
||||||
|
|
||||||
const vendor = ['redux', 'react', 'react-dom', 'react-router-dom'];
|
|
||||||
|
|
||||||
// if (!isDev) entry.vendor = vendor; // generate common vendor bundle in prod
|
// if (!isDev) entry.vendor = vendor; // generate common vendor bundle in prod
|
||||||
|
|
||||||
|
@ -102,10 +99,17 @@ module.exports = {
|
||||||
chunks: 'all',
|
chunks: 'all',
|
||||||
// see https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693#optimizationruntimechunk
|
// see https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693#optimizationruntimechunk
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
core: {
|
// corejs: {
|
||||||
test: module => {
|
// test: /[\\/]node_modules[\\/](core-js)[\\/]/,
|
||||||
if (/\/node_modules\/core-js\//.test(module.resource)) return true;
|
// chunks: 'all'
|
||||||
},
|
// },
|
||||||
|
chartjs: {
|
||||||
|
test: /[\\/]node_modules[\\/]chart\.js[\\/]/,
|
||||||
|
// name: 'chartjs',
|
||||||
|
chunks: 'all'
|
||||||
|
},
|
||||||
|
react: {
|
||||||
|
test: /[\\/]node_modules[\\/](react-dom|react|redux|react-router|react-router-dom|schedule|react-redux|react-modal)[\\/]/,
|
||||||
chunks: 'all'
|
chunks: 'all'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue