-
-
Notifications
You must be signed in to change notification settings - Fork 58
Labels
🐞 bugSomething isn't workingSomething isn't working
Description
Version
Rslib 0.0.10
Details
Rslib should inject __rslib_import_meta_url__ before using it. Otherwise there will be an runtime error:
- Input:
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
console.log(require.resolve('stylus-loader'));- Current output:
"use strict";
var __webpack_exports__ = {};
const external_node_module_namespaceObject = require("node:module");
const src_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
console.log(src_require.resolve('stylus-loader'));
var __webpack_export_target__ = exports;
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
value: true
});
var __rslib_import_meta_url__ = /*#__PURE__*/ function() {
return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
}();- Expected output:
"use strict";
var __webpack_exports__ = {};
var __rslib_import_meta_url__ = /*#__PURE__*/ function() {
return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
}();
const external_node_module_namespaceObject = require("node:module");
const src_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
console.log(src_require.resolve('stylus-loader'));
var __webpack_export_target__ = exports;
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
value: true
});Reproduce link
Reproduce Steps
- cd packages/plugin-stylus
- pnpm build
Metadata
Metadata
Assignees
Labels
🐞 bugSomething isn't workingSomething isn't working
