diff --git a/src/utils/options.js b/src/utils/options.js index 509fd9d..b85d264 100644 --- a/src/utils/options.js +++ b/src/utils/options.js @@ -6,7 +6,7 @@ function getOption({ opts }, name, defaultValue = true) { export const useDisplayName = state => getOption(state, 'displayName') export const useTopLevelImportPathMatchers = state => - getOption(state, 'topLevelImportPaths', []).map(pattern => new RegExp(pattern)) + getOption(state, 'topLevelImportPaths', []).map(pattern => new RegExp(`^${pattern}$`)) export const useSSR = state => getOption(state, 'ssr', true) export const useFileName = state => getOption(state, 'fileName') export const useMeaninglessFileNames = state => getOption(state, 'meaninglessFileNames', ['index']) diff --git a/test/fixtures/add-identifier-with-top-level-import-paths/.babelrc b/test/fixtures/add-identifier-with-top-level-import-paths/.babelrc index 9a4e75d..56b0d9b 100644 --- a/test/fixtures/add-identifier-with-top-level-import-paths/.babelrc +++ b/test/fixtures/add-identifier-with-top-level-import-paths/.babelrc @@ -8,7 +8,7 @@ "ssr": true, "topLevelImportPaths": [ "@xstyled/styled-components", - "@xstyled/styled-components/*" + "@xstyled/styled-components/.*" ], "transpileTemplateLiterals": false }