Skip to content

Commit

Permalink
feat: Add preserveSymlinks option
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
coreyfarrell committed Jan 26, 2020
1 parent 0aab6a9 commit eb4b2b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Add `bare-import-rewrite` to `plugins` in your babel settings.
"ignorePrefixes": ["//"],
"failOnUnresolved": false,
"resolveDirectories": ["node_modules"],
"processAtProgramExit": false
"processAtProgramExit": false,
"preserveSymlinks": true
}]
]
}
Expand Down Expand Up @@ -111,6 +112,10 @@ A list of extensions to use in resolver. Default `['.mjs', '.js', '.json']`.
This causes processing to occur during the babel `Program.exit` visitor. In general
this option is not needed.

### preserveSymlinks

This is passed to the `resolve` module. Default `true`.

### `.resolve(importModule, sourceFileName, pluginOptions)` - Resolve absolute path.

This function is used internally by the babel plugin, is exposed so it can be used
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function absResolve(importPath, sourceFileName, pluginOptions = {}) {
basedir: basedirResolve(importPath, sourceFileName, pluginOptions),
extensions: pluginOptions.extensions || ['.mjs', '.js', 'json'],
moduleDirectory: pluginOptions.resolveDirectories || 'node_modules',
preserveSymlinks: pluginOptions.preserveSymlinks !== false,
packageFilter(packageJson) {
packageJson.main = packageJson.module ||
packageJson['jsnext:main'] || packageJson.main;
Expand Down

0 comments on commit eb4b2b4

Please sign in to comment.