Use single build file (#635)

This commit is contained in:
Ivan Diaz 2019-10-07 14:50:10 -03:00 committed by GitHub
parent 68281e0985
commit 2ffb88c979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 23 deletions

View File

@ -13,6 +13,7 @@
<body>
<div id="app"></div>
<script src="/config.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=String.prototype.startsWith,Array.from,Array.prototype.fill,Array.prototype.keys,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,String.prototype.repeat,Number.isInteger,Promise&flags=gated"></script>
</body>
</html>

View File

@ -28,7 +28,6 @@
<?php if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)): ?>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=String.prototype.startsWith,Array.from,Array.prototype.fill,Array.prototype.keys,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,String.prototype.repeat,Number.isInteger,Promise&flags=gated"></script>
<?php endif; ?>
<script src="<?=$url ?>/vendor.js"></script>
<script src="<?=$url ?>/bundle.js"></script>
</body>
</html>

View File

@ -10,15 +10,11 @@ const {dependencies} = require('./package.json');
const BUILD_DIR = path.join(__dirname, 'build');
const APP_DIR = path.join(__dirname, 'src');
const VENDOR_LIST = Object.keys(dependencies);
const config = env => {
return {
devtool: 'source-map',
entry: {
config: APP_DIR + '/config.js',
bundle: APP_DIR + '/index.js',
vendor: VENDOR_LIST,
},
output: {
path: BUILD_DIR,
@ -93,30 +89,13 @@ const config = env => {
// }),
new CopyPlugin([
'./src/.htaccess',
'./src/config.js',
{from: './src/assets/images', to: 'images'},
]),
new BundleAnalyzerPlugin({
analyzerMode: process.env.NODE_ENV !== 'production' ? 'server' : 'disabled'
}),
],
optimization: {
splitChunks: {
cacheGroups: {
config: {
chunks: 'initial',
name: 'config',
test: 'config',
enforce: true,
},
vendor: {
chunks: 'initial',
name: 'vendor',
test: 'vendor',
enforce: true,
},
}
},
},
resolve: {
modules: ['./src', './node_modules']
},