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

Compatibility of umd/amd output. #2787

Closed
KyrieLii opened this issue Apr 17, 2023 · 1 comment
Closed

Compatibility of umd/amd output. #2787

KyrieLii opened this issue Apr 17, 2023 · 1 comment
Assignees
Labels
awaiting more feedback feat New feature or request

Comments

@KyrieLii
Copy link
Member

KyrieLii commented Apr 17, 2023

System Info

System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Pro
Memory: 15.74 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Browsers:
Chrome: 112.0.5615.49
Safari: 15.6.1
npmPackages:
@rspack/cli: latest => 0.1.7

Details

Some packages output files like this:
https://github.com/aui/art-template/blob/3.1.0/dist/template-debug.js#L728

Another example is lodash (but i don't find souce code):
image

To reproduce this issue, I have written a simple demo.

...
const mmm = {a: 'a'};

if (typeof define === "function") {
  define(function () {
    return mmm;
  });
} else if (typeof exports !== "undefined") {
  module.exports = mmm;
} else {
  this.mmm = mmm;
}

You can see the difference of outputs between rspack and webpack .

rspack:

image

webpack:

image

These differences will lead to some errors .

Tks!

Reproduce link

https://github.com/KyrieLii/rspack-webpack-demo/tree/amd-0.1.7

Reproduce Steps

Pls see README.

@KyrieLii KyrieLii added bug Something isn't working pending triage The issue/PR is currently untouched. labels Apr 17, 2023
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 17, 2023
@hyf0 hyf0 removed the pending triage The issue/PR is currently untouched. label Apr 17, 2023
@hyf0 hyf0 added this to the Planned milestone Apr 17, 2023
@underfin underfin self-assigned this Apr 18, 2023
@hyf0 hyf0 modified the milestones: Planned, 0.1.9 - Patch Apr 18, 2023
@underfin
Copy link
Collaborator

Look like need scan amd module syntax, it is a hard work at now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting more feedback feat New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants