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
[WIP] Externals #1216
[WIP] Externals #1216
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1216 +/- ##
==========================================
- Coverage 88.28% 87.86% -0.43%
==========================================
Files 77 78 +1
Lines 4355 4383 +28
==========================================
+ Hits 3845 3851 +6
- Misses 510 532 +22
Continue to review full report at Codecov.
|
I'm not sure var React = {foo: 'bar'}
// Uncaught ReferenceError: React is not defined
void function() {
const React = React
console.log('React', React)
}()
// logs "React undefined"
void function() {
var React = React
console.log('React', React)
}() Couldn't we just replace the |
@fathyb Ow didn't think about that, that'll make it way easier. |
@fathyb Just realised there isn't a way to add an asset based on content atm. |
@DeMoorJasper ah, had same problem for the Angular integration and its virtual fs. Alternatively we could just internally handle it in Lines 60 to 74 in bb7f4aa
It could be implemented using something like : async getDependencies() {
if (
this.options.rendition &&
this.options.rendition.hasDependencies === false
) {
return;
}
if(isExternal(this.name)) {
this.contents = `module.exports = ${getExternal(this)}`
// No need to parse dependencies or transform the AST
return
}
await this.loadIfNeeded();
if (this.contents && this.mightHaveDependencies()) {
await this.parseIfNeeded();
await this.collectDependencies();
}
} I don't know if changing the content on the fly doesn't have any side-effects (content hash, cache...). Thoughts? |
@fathyb Seems a bit hacky, not sure how to resolve this in a proper way. |
@DeMoorJasper Totally for it! 👍 I could also bring performance improvement if it's abstracted enough to build a in-memory fs like |
Can we do this inline system for now and when in memory fs is in place optimize it later?
|
@mohsen1 Feel free to open up a PR that implements this. |
Adds this as a dependency
SIDENOTE: This changes the resolvers rootPackage logic, now it gets the rootPackage inside bundler and adds it to the options object. This could potentially add a few ms to the ipc transfer times
Closes #144