-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: library does not load in webpack projects #364 #365
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked it up on the webpack docu, but I did not fully understand why you changed this. Can you elaborate what this does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, is it because of the Type any at the import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous
module.exports = M
is the export following CommonJS format. After different proofs I was not able to make it work in the example ts-webpack project.
So I decided to change the format to the ES Module syntax (that of course is what is used now in typescript projects). With this it worked perfectly in the webpack project and I had to do the other changes in the webpack output config to make it work in plain js projects.
The
optimization: {
minimize: false,
}
was only to debug the result code more easily but I think we can removed it now.
optimization: { | ||
minimize: false, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that? I guess because of the function name obfuscation due to minimization process.
Thanks for your contribution! Please next time please base your PR into the DEV branch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok local test worked, details can be handled later. Good work 👍
Proposed changes
Changed library export method to
export default M;
and the configuration of webpack output library to the options that has proved to work without breaking changes for existing doc pages and also for projects using the library in typescript classes and webpack for bundling.Types of changes
Checklist:
this can be tested with the webpack version of document that was linked in the issue description.
It would be good to have some official demo of the library in a webpack project
[x ] I have read the CONTRIBUTING document.
[x ] My commit messages follows the conventional commit format
My change requires a change to the documentation, and updated it accordingly.
I have added tests to cover my changes.
All new and existing tests passed.