-
Notifications
You must be signed in to change notification settings - Fork 700
Open
Labels
on hold: awaiting more feedbackWaiting for more users' feedback to decide the next actionWaiting for more users' feedback to decide the next actionp3: nice to have / edge casescope: rollup-compatwontfixThis will not be worked onThis will not be worked on
Description
The resolveImportMeta hook gives a way to allows to customize import.meta and import.meta.someProperty, see here
https://rollupjs.org/plugin-development/#resolveimportmeta. Here has a example for it.
function importMetaUrlCurrentModulePlugin() {
return {
name: 'import-meta-url-current-module',
resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
return `'${pathToFileURL(moduleId).href}'`;
}
if (property == null) {
return `{url:'${pathToFileURL(moduleId).href}'}`;
}
return null;
}
};
}The hook will return string code to replace original import.meta.xx. Because the rolldown using Ast to codegen. It is difficult to implement it, it need to the oxc has some ways create ast from string, we could using parse at now. If you has good ideas, please let me know.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
on hold: awaiting more feedbackWaiting for more users' feedback to decide the next actionWaiting for more users' feedback to decide the next actionp3: nice to have / edge casescope: rollup-compatwontfixThis will not be worked onThis will not be worked on