I've been trying to use Bitsrc to share front-end components throughout multiple applications. I'm able to create the components and export them to bitsrc, however when trying to import them and use them I run into errors.
I've set up a new aurelia application with au new
, using Typescript and RequireJS. I have then created a simple component consisting of just plain HTML.
- src
| - components
| - rocketship
| - rocketship.ts
| - rocketship.html
| - index.ts
When building this component using bit build
with the typescript compiler (@0.0.5
), the index.js.map
compiles to the following:
{"version":3,"file":"module.js","sourceRoot":"","sources":["module.tsx"],"names":[],"mappings":";;AAAA,2CAAsC;AAA7B,kCAAA,SAAO,EAAA"}
This references a file module.js
which is not defined anywhere, which leads me to believe that that is cause the issue I'm having.
When I install the component through NPM, and add it to aurelia.json
like this:
{
"name": "@bit/user.workspace.components.rocketship",
"path": "../node_modules/@bit/user.workspace.components.rocketship/dist",
"main": "index"
}
And run the app using au run -w
, I get the error:
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>
So the Aurelia CLI is trying to read a file module.js.map
in the component's folder, which does not exist. Is there something wrong with the Typescript transpiler? Or is Aurelia not capable of handling the result of the transpiled component?
The transpiler I'm using is
bit.envs/compilers/typescript@0.0.5