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

[Bug]: The SourceMapDevToolPlugin fileContext does not meet expectations #8881

Closed
idy1000 opened this issue Dec 30, 2024 · 0 comments · Fixed by #8888
Closed

[Bug]: The SourceMapDevToolPlugin fileContext does not meet expectations #8881

idy1000 opened this issue Dec 30, 2024 · 0 comments · Fixed by #8888
Assignees
Labels
bug Something isn't working

Comments

@idy1000
Copy link

idy1000 commented Dec 30, 2024

System Info

System:
OS: macOS 13.6.3
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 42.59 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 7.33.1 - ~/.nvm/versions/node/v14.15.3/bin/pnpm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Browsers:
Chrome: 131.0.6778.205
Safari: 16.6
npmPackages:
@rspack/cli: ^1.1.8 => 1.1.8
@rspack/core: ^1.1.8 => 1.1.8
@rspack/plugin-react-refresh: 1.0.0 => 1.0.0

Details

配置见复现路径,产物的文件结构如图
Image
预期是没有dist/js/main_9ba8f56720d7142d.js文件,且dist/assets/js/main_9ba8f56720d7142d.js中的sourceMappingURL为带域名的地址:http://test.com/sourcemaps/js/main_9ba8f56720d7142d.js.map
webpack同样的配置是符合预期的

把fileContext注释是符合预期的
Image

Reproduce link

No response

Reproduce Steps

  1. 创建项目:npx create-rspack --dir my-project --template react
  2. 修改配置:
{
    // ...
    output: {
        filename: 'assets/js/[name]_[contenthash].js',
    },
    plugins: [
        new rspack.SourceMapDevToolPlugin({
            test: [/\.(js|jsx|ts|tsx)$/],
            filename: `sourcemaps/[file].map`,
            publicPath: 'http://test.com/',
            fileContext: 'assets',
        }),
        // ...
    ]
}
  1. npm run build
@idy1000 idy1000 added bug Something isn't working pending triage The issue/PR is currently untouched. labels Dec 30, 2024
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Dec 30, 2024
@LingyuCoder LingyuCoder changed the title [Bug]: SourceMapDevToolPlugin fileContext不符合预期 [Bug]: The SourceMapDevToolPlugin fileContext does not meet expectations Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants