-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
[bug]resolve.alias 无法正确解析 moment 包 #4187
Comments
I believe this is an issue related to this: moment/moment#6092. Have you try to use moment with locale package? |
no, but when use with esbuild, it did not throw an error |
when direct import like below which also can reproduce this issue. import moment from "./node_modules/moment/min/moment.min.js"
moment(new Date()).format("yyy-mm-dd"); This problem occurs when using @h-a-n-a I have updated cases here https://github.com/Fi2zz/rspack-alias-bug |
Would you take a look? @underfin |
Tried with webpack, webpack also have the problem, and checkout the code in actually you can avoid this problem by importing "moment.js" instead of "moment.min.js", and in production rspack will minimize the code anyway but besides this there is also another blocker: aliasedRequire = require;
aliasedRequire('./locale/' + name); aliasedRequire hasn't supported in rspack yet #3955, so you need to patch it to make it works // aliasedRequire = require;
require('./locale/' + name); |
thanks , I tried with webpack in development mode which throw error but production mode don't. this solution also works for |
System Info
System:
OS: macOS 13.5.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 153.21 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.6.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.13.2 - /usr/local/bin/npm
pnpm: 8.3.1 - /usr/local/bin/pnpm
Browsers:
Chrome: 116.0.5845.179
Safari: 16.6
npmPackages:
@rspack/cli: latest => 0.3.2
Details
case 1
case 2
Reproduce link
https://github.com/Fi2zz/rspack-alias-bug
Reproduce Steps
The text was updated successfully, but these errors were encountered: