-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The regular expressions defined in
Lines 84 to 86 in ba86053
| new RegExp(path.parse(outputPaths.app.js).name + '(.*js)'), | |
| new RegExp(path.parse(outputPaths.vendor.js).name + '(.*js)'), | |
| new RegExp(path.parse(outputPaths.tests.js).name + '(.*js)'), |
are very loose, and will result in renaming require/define in any js asset with a filename that contains the words "tests", "vendor", or the ember app's configured modulePrefix.
When ember-auto-import@2 is used in a non-trivial app, it will output a large number of js assets, and by default many of these will contain "vendor" somewhere in the filename. These files will have usages of "require" and "define" rewritten by this addon, and this can cause cause runtime errors or subtly incorrect behaviors that.
To add to the complexity, there are a couple files output by ember-auto-import@2 that do need to be processed by this addon: the primary app and tests entrypoints do need to be rewritten so they can capture the renamed require/define functions the app is using.
I'm logging this issue mostly to share information. We have worked around this issue in our apps, and we are also working to drop this addon entirely in the future. We could tighten up these regexes, though it would take some experimentation to figure out exactly how to do that. If anyone else runs into something like this, I may be able to advise on a solution.