Skip to content

Commit

Permalink
feat: handle double quotes lodash imports (#4)
Browse files Browse the repository at this point in the history
* Handle double quotes imports

I've found this code from https://github.com/mikeduminy/esbuild-plugin-ramda/blob/main/index.js#L18. Thank you @mikeduminy !

* Update index.js

* Update index.js
  • Loading branch information
omeraplak authored May 22, 2022
1 parent ed47c2b commit ee59f86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function pluginLodashImport(options = {}) {
const extension = path.extname(args.path).replace('.', '');
const loader = JS_EXTENSIONS.has(extension) ? 'jsx' : extension;

const lodashImportRegex = /import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:'lodash\/?.*?'))[\s]*?(?:;|$|)/g;
const lodashImportRegex = /import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)[\'\"](?:(?:lodash\/?.*?))[\'\"][\s]*?(?:;|$|)/g;

const lodashImports = contents.match(lodashImportRegex);

Expand Down

0 comments on commit ee59f86

Please sign in to comment.