Highlights π‘
π Support for import.meta.filename, import.meta.dirname, and import.meta.resolve
Rspack now supports the import.meta.filename, import.meta.dirname, and import.meta.resolve meta properties in ESM modules.
These properties provide a standardized way to access file and directory paths in ES modules, similar to the CommonJS __filename and __dirname variables:
// Get the absolute path of the current module file
console.log(import.meta.filename);
// e.g., "/path/to/project/src/index.js"
// Get the directory path of the current module
console.log(import.meta.dirname);
// e.g., "/path/to/project/src"
// Resolve a module specifier to an absolute URL
const resolvedPath = import.meta.resolve('./utils.js');Thanks to @magic-akari for this contribution!
What's Changed
New Features π
- feat: update resolver error messages to use colored output by @chenjiahan in #12348
- feat: Support
import.meta.filename/dirname/resolveby @magic-akari in #12317 - feat: support
[relative-resource-path]in moduleFilenameTemplate by @SyMind in #12370
Bug Fixes π
- fix(diagnostic): dim gutter and loader info for better visual hierarchy by @chenjiahan in #12341
- fix: avoid conflict for inlined const identifier by @ahabhgk in #12347
- fix(rstest): dedicated to hoist @rstest/core declaration by @fi3ework in #12302
- fix: don't use sync fs api by @stormslowly in #12353
- fix: should use sourceOrder to sort module outgoing in buildChunkGraph by @JSerFeng in #12351
- fix(rstest): always hoist @rstest/core init fragment by @fi3ework in #12363
- fix: extracted comments should be behind the shebang by @CPunisher in #12380
- fix: persistent cache save lazy barrel affected modules by @jerrykingxyz in #12384
- fix: prevent URLPlugin from parsing new URL(import.meta.url) by @LingyuCoder in #12386
- fix: typo in preload runtime of CssExtractPlugin by @JSerFeng in #12387
Refactor π¨
- refactor: rename module arguments to rspack specific by @LingyuCoder in #12350
- refactor: cache test case support NEXT_MOVE_DIR_START by @jerrykingxyz in #12359
- refactor: side effect optimize artifacts to deref option by @stormslowly in #12334
- refactor: render runtime module identifier by runtime template by @LingyuCoder in #12360
- refactor: recalculate all chunk ids with cache by @JSerFeng in #12374
- refactor: render javascript runtime globals according to compiler options by @LingyuCoder in #12371
- refactor: optimize runtime multiple line string literal by @LingyuCoder in #12381
- refactor: support
.rspack[...]syntax and rebrand CSS extract plugin internals by @LingyuCoder in #12385
Other Changes
- chore(workflow): run diff CI on push events by @yifancong in #12346
- chore: release v1.6.6 by @LingyuCoder in #12345
- chore: fix taplo format script by @stormslowly in #12349
- ci: remove legacy ecosystem CI yaml by @fi3ework in #12352
- chore(deps): update dependency @shikijs/transformers to ^3.18.0 by @renovate[bot] in #12357
- chore(deps): update patch npm dependencies by @renovate[bot] in #12355
- chore(deps): bump Rslib v0.18.3 by @Timeless0911 in #12362
- chore(deps): update dependency prebundle to ^1.6.0 by @renovate[bot] in #12327
- chore(deps): update pnpm to v10.24.0 by @renovate[bot] in #12328
- chore(deps): update dependency @playwright/test to v1.57.0 by @renovate[bot] in #12356
- chore(deps): pin action dependencies by @renovate[bot] in #12354
- chore(deps): update dependency react to ^19.2.1 by @renovate[bot] in #12364
- chore: add napi::tokio_runtime::block_on by @stormslowly in #12358
- chore(ci): move rust-cache Action to rspack-contrib by @stormslowly in #12368
- test: split Config, Watch and NativeWatcher tests into 3 parts for better parallelization by @LingyuCoder in #12379
- test: bump Rstest to v0.7.1 by @9aoy in #12390
Full Changelog: v1.6.6...v1.6.7