npm @rspack/core 1.6.7
v1.6.7

one day ago

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

Don't miss a new core release

NewReleases is sending notifications on new releases.