-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
preact debug mode with ES6 imports #1746
Comments
The problem about es6 imports in this case is that they are static. One might not make them conditional by design. The dynamic import you mentioned makes this possible, but adds the preact options too late and thus some things might not work. As far as I know there should not be any drawback on using a If you really want this and you are using webpack you could use the |
That syntax isnt es6 import, its dynamic import whose sole purpose is to delay loading. Import thing and export thing is the es module syntax , but im not sure that really means anything if you use webpack. The output generated isnt anything close to es module, i would argue closer to amd than anything. Basically,Just use what works bc it doesnt matter |
Closing, @sventschui and @jeremy-coleman summed up the situation perfectly 👍 |
I understand, but can't https://github.com/facebook/prop-types/blob/master/index.js#L8 |
The docs are showing
require
usage but what's the correct way to import this with ES6 and only in development?The following is indeed not working: proptypes validation is enabled after components are mounted thus those are not validated.
The following on top of index.js mean including also in production the debug logic.
Any help?
My hint:
preact/debug
should export a function, this allows the developer to import it and run it only if NODE_ENV=development and tree-shake it away in production.PS: great work guys!
The text was updated successfully, but these errors were encountered: