Closed
Description
Hi, comrades.
I'm trying to make multiple webpack configurations as described here -https://symfony.com/doc/current/frontend/encore/advanced-config.html#defining-multiple-webpack-configurations.
But, after compiling I get incorrect manifest and entrypoints files only with first entry and get error "An exception has been thrown during the rendering of a template ("Could not find the entry "mobile" in "/var/www/tst.loc/public/build/entrypoints.json". Found: entrypoints.")."
How to fix it?
webpack.config.js:
var Encore = require('@symfony/webpack-encore');
////////////////////////////////////////////////////////////////////////////////
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('full', './assets/js/full.js')
.enableLessLoader()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureFilenames({
css: 'full/css/[name]-[hash:6].css',
js: 'full/js/[name]-[hash:6].js'
})
const fullConfig = Encore.getWebpackConfig();
fullConfig.name = 'full';
fullConfig.watchOptions = {
poll: true,
ignored: /node_modules/
};
Encore.reset();
////////////////////////////////////////////////////////////////////////////////
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('mobile', './assets/js/mobile.js')
.enableLessLoader()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureFilenames({
css: 'mobile/css/[name]-[hash:6].css',
js: 'mobile/js/[name]-[hash:6].js'
})
const mobileConfig = Encore.getWebpackConfig();
mobileConfig.name = 'mobile';
mobileConfig.watchOptions = {
poll: true,
ignored: /node_modules/
};
Encore.reset();
module.exports = [fullConfig, mobileConfig];
result of entrypoints.json:
{
"entrypoints": {
"full": {
"js": [
"/build/full/js/runtime-a0244a.js",
"/build/full/js/full-a0244a.js"
],
"css": [
"/build/full/css/full-a0244a.css"
]
}
}
}
}
}
}
result of manifest.json:
{
"build/full.css": "/build/full/css/full-a0244a.css",
"build/full.js": "/build/full/js/full-a0244a.js",
"build/runtime.js": "/build/full/js/runtime-a0244a.js"
}
Metadata
Metadata
Assignees
Labels
No labels