Skip to content
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

dynamic import not work #4201

Closed
izengliang opened this issue Feb 21, 2020 · 2 comments
Closed

dynamic import not work #4201

izengliang opened this issue Feb 21, 2020 · 2 comments

Comments

@izengliang
Copy link

🐛 bug report

😯 Current Behavior

image

💻 Code Sample

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="index.js"></script>
</body>
</html>

index.js

console.log("index js file");

import("./lib/lib.js").then(()=>{})

function loadModule(path) {
    setTimeout(() => {
    import("./"+path+"/lib.js").then(()=>{});
    }, 200);
}

loadModule("lib");

lib/lib.js

console.log("2323322332")

🌍 Your Environment

Software Version(s)
Parcel next
Node v12.13.1
npm/Yarn yarn
Operating System mac
@DeMoorJasper
Copy link
Member

Not entirely sure how you expect this to work?

We need to be able to statically extract which modules to create otherwise we can never create bundles reliably on build. Maybe a regex of bundles to create and we inject an index mapping to the hashes in the js bundles?

This seems more of an RFC thing than an actual bug

@mischnic
Copy link
Member

Duplicate of #125

@mischnic mischnic marked this as a duplicate of #125 Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants