firsttris / html-webpack-multi-build-plugin Goto Github PK
View Code? Open in Web Editor NEWThis plugin simplifies the creation of script tags for module and nomodule for a webpack multi build configuration
License: MIT License
This plugin simplifies the creation of script tags for module and nomodule for a webpack multi build configuration
License: MIT License
Hi,
I'm trying to use your package in combination with multi compilation in webpack (as where your package has been made for).
Currently I do not get the module, nomodule. It seems not to be using your template;
I get these scripts:
<script type="text/javascript" src="/clientname/main.498e96cffe9164bcd48f.js"></script><script type="text/javascript" src="/clientname/main_legacy.43cb4eb4036961c726bb.js"></script></body>
As output, this will obviously not work, my webpack config is basically the same, but deconstructed into two arrays:
module.exports = [
{
entry: { 'main_legacy': [].concat('@babel/polyfill', baseWebpackConfig.entries) },
module: {
rules: loadersEs5,
},
...config,
},
{
entry: { main: baseWebpackConfig.entries },
module: {
rules: loaders,
},
...config,
},
];
(not sure if I need that polyfill there, but that's currently not important). I've also tried adding the HtmlWebpackPlugin and HtmlMultiBuildPlugin separately (to make sure they are not the same object). But in that case I just get the script tags double.
I also noticed I was using inject, after disabling I didn't get any bundles in my template.
I'm using:
"html-webpack-multi-build-plugin": "^1.0.0",
"html-webpack-plugin": "3.2.0",
with webpack 4.20 something.
As noted in #1 after rebuilds when using hashes in filenames (chunk hashes). The dev mode will include multiple main bundles. This obviously brings forward some issues.
I'm not entirely sure how to fix, as clearing pre-emit sometimes results in only one bundle to remain (and possibly only legacy so whitespace etc.).
A possibility, though seems flaky, would be to filter the stored files (in the plugins js array) based on the incoming files. Possibly we can get the entry point filename(s) and make sure we only keep the latest?
Better ideas welcome.
I was not able to find specific Multi compiler hooks, also clearing the js array is tricky if something goes wrong during the build as you'll only have the singular js file and potentially white pages.
sometimes when we do builds, either the modern or the legacy bundle is missing.
in index.html there is just and empty script tage like this
<script type="module"></script>not quite sure why this happens.
is this because the plugin is using an async tab?
if you have an idea please reply
regards
Tristan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.