Skip to content

v1.6.7

Latest

Choose a tag to compare

@JSerFeng JSerFeng released this 09 Dec 09:52
· 15 commits to main since this release

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/resolve by @magic-akari in #12317
  • feat: support [relative-resource-path] in moduleFilenameTemplate by @SyMind in #12370

Bug Fixes 🐞

Refactor πŸ”¨

Other Changes

Full Changelog: v1.6.6...v1.6.7