Recently, I attempted to utilize Bitsrc for sharing front-end components across multiple applications. Although I successfully created and exported the components to bitsrc, I encountered errors when attempting to import and use them.
To elaborate, I set up a new aurelia application using Typescript and RequireJS by initiating it with au new
. Following that, I developed a basic component comprising simple HTML structure:
- src
| - components
| - rocketship
| - rocketship.ts
| - rocketship.html
| - index.ts
Upon building this component using bit build
coupled with the typescript compiler (@0.0.5
), the index.js.map
seemed problematic:
{"version":3,"file":"module.js","sourceRoot":"","sources":["module.tsx"],"names":[],"mappings":";;AAAA,2CAAsC;AAA7B,kCAAA,SAAO,EAAA"}
The presence of a file named module.js
, which wasn't defined in any location, led me to believe that it could be the root cause of my issues.
After installing the component via NPM and adding it to aurelia.json
as shown below:
{
"name": "@bit/user.workspace.components.rocketship",
"path": "../node_modules/@bit/user.workspace.components.rocketship/dist",
"main": "index"
}
Upon running the application using au run -w
, an error surfaced:
Error: An error occurred while trying to read the map file at C:\Git\Aurelia test application\node_modules\@bit\user.workspace.components.rocketship\dist\module.js.map
Error: ENOENT: no such file or directory, open 'C:\Git\Aurelia test application\node_modules\@bit\user.workspace.components.rocketship\dist\module.js.map'
at readFromFileMap (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:32:11)
at new Converter (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:39:32)
at Object.exports.fromMapFileComment (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:112:10)
at Object.exports.fromMapFileSource (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:131:22)
at acquireSourceMapForDependency (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\bundle.js:184:33)
at work.then (C:\Git\Aurelia test application\node_modules\aurelia-cli\lib\build\bundle.js:206:25)
at <anonymous>
This situation indicates that Aurelia CLI is looking for a non-existent file named module.js.map
within the component's folder. Is there a fault in the Typescript transpiler or perhaps Aurelia struggles to handle the outcome of the transpiled component?
The transpiler currently in use is
bit.envs/compilers/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="89fdf0f9ecfaeafbe0f9fdc9b9a7b9a7bc">[email protected]</a>