Closed tstirrat15 closed 4 years ago
What does an esModule mean in the context of file-loader?
From docs:
By default, file-loader generates JS modules that use the ES modules syntax. There are some cases in which using ES modules is beneficial, like in the case of module concatenation and tree shaking.
How would it be imported and used? Is it meant for end consumption (i.e. being a loader by itself), or is it more meant for chaining?
Always yes.
When would the features esModule enables (like tree-shaking) be used? We're primarily using file-loader for image references, and it isn't clear where or how tree-shaking would happen when your imports are singular.
How tree-shaking works is out of the repo.
You can find a lot of articles about tree shaking and import
/export
Always yes.
Is that yes to end consumption or is that yes to chaining? I think that would answer my question.
Are we able to use import()
function or only import
statement? I get src="[object Promise]"
as the output when I use import()
even though I have esModule: true
.
@rightaway update html-loader to latest version
I'm not using html-loader. You mean file-loader? I'm using latest 6.0.0. This is in a Vue template file btw.
Documentation Is:
Please Explain in Detail...
In v5
esModules
became a default. That broke my application, and making itfalse
fixed it, but I have no idea why, and the documentation isn't clear on this note.esModule
mean in the context offile-loader
?esModule
enables (like tree-shaking) be used? We're primarily usingfile-loader
for image references, and it isn't clear where or how tree-shaking would happen when your imports are singular.Your Proposal for Changes
Answers to questions above. I'm happy to (re)write them into the documentation.