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

Error when using absolute path to reference online resources (non-local resources) in less #1518

Open
ChenXplorer opened this issue Oct 23, 2024 · 9 comments

Comments

@ChenXplorer
Copy link

See web-infra-dev/rsbuild#1948

i can not resolve this problem,

when add the following code:
builderConfig:{
output: {
externals: [//image/font/g],
},
},

error :
× Module build failed:
╰─▶ × Error: HookWebpackError: Invalid regular expression flags

Originally posted by @ChenXplorer in #1515

@Timeless0911
Copy link
Collaborator

Image

@ChenXplorer
Copy link
Author

Image

Image

@Timeless0911
Copy link
Collaborator

Where is the escape character???

@ChenXplorer
Copy link
Author

Where is the escape character???

When copied to GitHub, it was escaped, but this is how it is in the code
Image

@Timeless0911
Copy link
Collaborator

Please provide a reproduce repo.

@ChenXplorer
Copy link
Author

ChenXplorer commented Oct 24, 2024

Please provide a reproduce repo.

[email protected]:ChenXplorer/reproduction_for_rspress.git

yarn && yarn dev

同时,本来想同时复现playground一个偶发报错问题,但现在引入playground组件就启动卡住了,你可以config文件注释了的 // plugins: [pluginPlayground()], 打开试试

@Timeless0911
Copy link
Collaborator

You can try to use

source: {
  alias: {
    "/image/font": false,
  },
},

@ChenXplorer
Copy link
Author

You can try to use

source: {
alias: {
"/image/font": false,
},
},

这个会有其他问题,你可以看看 web-infra-dev/rsbuild#1948

@Timeless0911
Copy link
Collaborator

如果你是想要保留 css 里面的 url 字符串的话,可以直接改 css-loader 的配置

tools: {
  cssLoader: {
    url: {
      filter: (url) => {
        if (/\/image\/font/.test(url)) {
          return false;
        }
        return true;
      },
    },
  },
},

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

2 participants