-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Detect AMD loader in prelude to differentiate node require from AMD require #2781
Conversation
…uire Fixes dynamic imports, when an AMD loader (like requirejs) is present.
I tried to get the CI green, but it seems only node_6_x is currently failing. |
Just wondered why there was no comment on this change yet and I realized that the test-example is not working completely, because dynamic imports are not allowed in HTML documents yet. To mimic the issue I've create the following files: index.html: <!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Parcel + RequireJS</title>
<script>
// prevent parcel picking up this script
document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"><\x2fscript>');
</script>
</head>
<body>
<script src="index.js"></script>
</body>
</html> index.js: import('./dynamic_import').then(() => {}); dynamic_import.js: console.log('works'); When I now execute
|
The node 6 tests failed for me before. Does that relate to my change? |
No, we can't figure out why the Windows tests sometimes fail without any error message... |
Is this pull mergeable now or do I need to adjust something? |
The tests went through now. Is there something to change to get this merged? |
Closing it because it was not merged for 6 months. |
↪️ Pull Request
Fixes loading dynamic imports, when an AMD loader (like requirejs) is present on a page before a parcel bundle with dynamic imports got loaded. Currently when requirejs was loaded before loading a parcel bundle with dynamic imports it fails with:
💻 Examples
🚨 Test instructions
With the above example and bundling the index.html you'll see the mentioned error.
✔️ PR Todo