-
-
Save bojan88/9e3e608b1109decb86e400854144aac5 to your computer and use it in GitHub Desktop.
Chunk and template replacement in preact-cli build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (env.production && !env.isServer) { | |
config.entry['public-bundle'] = path.resolve(__dirname, 'public-page.entry.js'); | |
for (const { plugin: { options } } of helpers.getPluginsByName(config, 'HtmlWebpackPlugin')) { | |
if (options.url === '/account') { | |
options.chunks = ['bundle', 'polyfills']; | |
options.template = `!!ejs-loader?esModule=false!${path.resolve(__dirname, './src/app-template.ejs')}`; | |
} else { | |
options.chunks = ['public-bundle', 'polyfills']; | |
options.template = `!!ejs-loader?esModule=false!${path.resolve(__dirname, './src/public-template.ejs')}`; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment