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

Support more export forms #624

Closed
thekip opened this issue Mar 8, 2023 · 1 comment
Closed

Support more export forms #624

thekip opened this issue Mar 8, 2023 · 1 comment
Labels
Milestone

Comments

@thekip
Copy link

thekip commented Mar 8, 2023

According to the docs njs expect functions to be exported in the following form

export default {
  myFn1,
  myFn2
}

It also stated that njs support only subset of js syntax. This is fine.

However, when it comes to bundling few files into one all modern bundlers such as esbuild and rollup will transform this export construction to something similar to this:

var filename_default = {
  myFn1,
  myFn2
};

export {
  filename_default as default
};

And that exact construction is not supported by njs. Unfortunately, there are no way to tune how these bundlers will output the code, hence this incompatibility make using modern bundlers completely impossible.

Browserify mentioned in the docs is dead. Last publish on npm was 2 years ago. Actually, i thought it was deprecated and abandoned in favor of webpack back in 2015, so it's not a viable solution for 2023.

The proposal is to add support this exact notation to unblock usage njs with modern bundlers such as esbuild / rollup

@thekip
Copy link
Author

thekip commented Mar 9, 2023

Related discussion in rollup repo rollup/rollup#4182 (comment)

@xeioex xeioex added this to the 0.7.12 milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants