Skip to content

Commit

Permalink
fix: .mjs configuration file error
Browse files Browse the repository at this point in the history
Signed-off-by: ajiho <[email protected]>
  • Loading branch information
ajiho authored and antonk52 committed Dec 3, 2024
1 parent 2cb3e75 commit 60a98c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
coverage
.DS_Store
.vscode
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const path = require('path');
const fs = require('fs');
const os = require('os');
const url = require('url');

const fsReadFileAsync = fs.promises.readFile;

Expand Down Expand Up @@ -54,8 +55,9 @@ module.exports.defaultLoadersSync = defaultLoadersSync;
/** @type {import('./index').Loader} */
const dynamicImport = async id => {
try {
const mod = await import(/* webpackIgnore: true */ id);

const fileUrl = url.pathToFileURL(id).href;
const mod = await import(/* webpackIgnore: true */ fileUrl);

return mod.default;
} catch (e) {
try {
Expand Down

0 comments on commit 60a98c1

Please sign in to comment.