Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
fix: Add support for custom resolvePath from babel plugin (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-c-jiang authored and tleunen committed Jan 23, 2020
1 parent 97c0a77 commit 5708051
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getPluginOptions(file, cwd, defaultOptions) {
cwd: plugin.options.cwd || config.cwd,
root: config.root.concat(plugin.options.root || []),
alias: Object.assign(config.alias, plugin.options.alias || {}),
resolvePath: plugin.options.resolvePath || config.resolvePath,
extensions: plugin.options.extensions || config.extensions,
}),
defaultOptions,
Expand Down Expand Up @@ -98,12 +99,14 @@ exports.resolve = (source, file, opts) => {
cwd: options.cwd || projectRootDir,
root: options.root || [],
alias: options.alias || {},
resolvePath: options.resolvePath,
extensions: options.extensions || defaultExtensions,
},
);

const finalSource = stripWebpack(source, pluginOptions.alias);
const src = resolvePath(finalSource, file, pluginOptions);
const resolvePathFunc = pluginOptions.resolvePath || resolvePath;
const src = resolvePathFunc(finalSource, file, pluginOptions);

const extensions = options.extensions || pluginOptions.extensions;

Expand Down

0 comments on commit 5708051

Please sign in to comment.