-
Notifications
You must be signed in to change notification settings - Fork 8
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
Reconfigure webpack for pollyfilling and tree shaking #37
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.
LGTM with comments addressed.
@@ -17,16 +17,22 @@ const copies = { | |||
const { eslintConfig, main: entryPoint } = require(resolveExtensionPath("package.json")); | |||
const eslintEnabled = eslintConfig || fs.readdirSync(extensionPath).find(f => f.startsWith(".eslintrc")); | |||
const jsLoaders = [{ | |||
loader: require.resolve("babel-loader"), |
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.
If I remember it right, this helps when you run zem locally within its own directory.
How is your local development workflow? If we have a better way to run/test zem locally we can get rid of this.
☝️ We have another require.resolve
usage in this module.
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 found several places that we use require.resolve
and fix it. As far as I understand require.resolve
import the module and return the file path instead of module itself. In our case this is redundant, since webpack can resolve the module from file name.
We also use it at manifest-builder: delete require.cache[require.resolve(pkgInfoPath)];
. I'm not sure that we should remove from here also. That's why I didn't remove it.
"@babel/preset-env", | ||
{ | ||
useBuiltIns: "usage", | ||
corejs: 3, |
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 think we should add core-js@3
to the list of "dependencies" of zem since this is going to be needed in case a feature that requires polyfill is used.
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.
It's already added. "core-js": "^3.6.4"
🤔
Co-authored-by: Sertac Olgunsoylu <dirtybit@users.noreply.github.com>
This PR applies guidelines for tree shaking