Skip to content

[Feature]: NodeStuffPlugin plugin of Rspack need to align with webpack #32

@Timeless0911

Description

@Timeless0911

What problem does this feature solve?

webpack support config node-module in node.__filename and node.__dirname

This is useful for shims of esm bundle artifacts.

What does the proposed API look like?

const getImportMetaUrl = () =>
  typeof document === 'undefined'
    ? new URL('file:' + __filename).href
    : (document.currentScript && document.currentScript.src) ||
      new URL('main.js', document.baseURI).href

export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()

Metadata

Metadata

Assignees

Labels

RspackRspack related issueWIPThis issue is being resolved or under development

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions