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

Add dynamic require tests #420

Open
aminya opened this issue May 4, 2021 · 0 comments
Open

Add dynamic require tests #420

aminya opened this issue May 4, 2021 · 0 comments

Comments

@aminya
Copy link

aminya commented May 4, 2021

The CJS tests are requiring modules at the top level which is different from dynamic requires. The tests should also cover dynamic requires.

https://github.com/GoogleChromeLabs/tooling.report/blob/dev/tests/importing-modules/subtests/commonjs/rollup/src/index.js

const cjs = require('./cjs');
console.log(cjs);

The proposed test for dynamic requires:

function main() {
  const cjs = require('./cjs');
  console.log(cjs);
}

The tool should code-split the lazy-loaded module similar to dynamic imports.

Dynamic requires are very important because the new ECMascript standard doesn't provide any way to synchronously lazy load a module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant