Use single build file

This commit is contained in:
Ivan Diaz 2019-10-07 14:47:28 -03:00
parent 68281e0985
commit c475d0e35c
3 changed files with 2 additions and 23 deletions

View File

@ -13,6 +13,7 @@
<body> <body>
<div id="app"></div> <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> <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> </body>
</html> </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)): ?> <?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> <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; ?> <?php endif; ?>
<script src="<?=$url ?>/vendor.js"></script>
<script src="<?=$url ?>/bundle.js"></script> <script src="<?=$url ?>/bundle.js"></script>
</body> </body>
</html> </html>

View File

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