I try to import jquery.ui.position for a another file like so:
module: {
loaders: [
{
test: /index\.js$/,
loader: 'imports?jquery.ui.position' // This line throws an error
}
]
},
which gets an error much like the following.
ERROR in ./index.js
Module parse failed: S:\Github\webpack_import_loader_bug\node_modules\imports-loader\index.js?jquery.ui.position!S:\Github\webpack_import_loader_bug\index.js Unexpected token (2:10)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:10)
at Parser.pp$4.raise (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:2221:15)
at Parser.pp.unexpected (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:603:10)
at Parser.pp.semicolon (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:581:61)
at Parser.pp$1.parseVarStatement (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:918:10)
at Parser.pp$1.parseStatement (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:706:19)
at Parser.pp$1.parseTopLevel (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:638:25)
at Parser.parse (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:516:17)
at Object.parse (S:\Github\webpack_import_loader_bug\node_modules\acorn\dist\acorn.js:3098:39)
at Parser.parse (S:\Github\webpack_import_loader_bug\node_modules\webpack\lib\Parser.js:902:15)
at DependenciesBlock. (S:\Github\webpack_import_loader_bug\node_modules\webpack\lib\NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
at nextLoader (S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
at S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:292:15
at runSyncOrAsync (S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:160:12)
at nextLoader (S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:290:3)
at S:\Github\webpack_import_loader_bug\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (S:\Github\webpack_import_loader_bug\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
at S:\Github\webpack_import_loader_bug\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose as oncomplete
After much hair-pulling and gnashing of teeth I try to alias jquery.ui.position as jquery_ui_position, which works as expected. Apparently the dots within the module name throw the import loader off.
Am I supposed to escape the dots in some fashion? The documentation doesn't say.
I try to import jquery.ui.position for a another file like so:
which gets an error much like the following.
After much hair-pulling and gnashing of teeth I try to alias jquery.ui.position as jquery_ui_position, which works as expected. Apparently the dots within the module name throw the import loader off.
Am I supposed to escape the dots in some fashion? The documentation doesn't say.
I have set up a tiny example project which demonstrates the issue at https://github.com/sgarcialaguna/import-loader-bug