Open danthedaniel opened 6 years ago
Perhaps a better solution is to modify the compile()
function in lib/fs_utils/source_file.js
from brunch
From this -
compile() {
const path = this.path = this._realPath;
// ...
.then(processFile)
.then(file => {
this.type = this.type || file.type || '';
file.compiled = file.data;
return file;
})
// ...
}
to this -
compile() {
const path = this.path = this._realPath;
// ...
.then(processFile)
.then(file => {
this.type = this.type || file.type || '';
file.compiled = file.data;
file.path = path; // Makes sure that the internally stored path remains unchanged
return file;
})
// ...
}
I noticed what I think is this issue when making changes to the typescript-brunch
plugin myself. Weirdly, node_modules
is included fine with Typescript@2.2.2 or lower, but 2.3.0 and above cause the symptoms described here, where it seems like deppack just doesn't find my imports. Not sure why this would be version-dependent.
@teaearlgraycold diving further, I think the "real" error is this:
return Object.assign({}, compiled, {
dependencies,
type: compiler.type,
path: compiler.targetExtension ?
path.replace(extRe, compiler.targetExtension) :
path,
});
in fs_utils/pipeline.js
in Brunch. It's replacing the path based on the extension (".js") specified by the typescript-brunch plugin, which causes the issue you noted with isJs
.
Aha - it's due to commit 7e99449 on typescript-brunch, which adds the target extension property. That might be why it started happening when you switched to a fork, since the fork you mention seems to be up-to-date with master. It's why my own fork also has this issue. I didn't notice that latest commit hasn't been released, which is why the version from npm install
still works fine. I'm opening a corresponding issue on the typescript-brunch
repo.
Any news on this? This issue still persists?
You can see the news in this issue. Since noone worked on it, it still persists.
None of my required files make it into the bundle if they're from
node_modules
. I've tracked this down to the functionisJs
inlib/explore.js
:Because my paths are being transformed (eg:
js/views/not_found.tsx
tojs/views/not_found.js
) this function does not work correctly. I've been able to fix the issue by changing it to:Oddly, this issue only emerged after I switched to a fork of
typescript-brunch
(specifically this) and when I try to switch back to the official package the problem persists. I've even gone as far as wiping mynode_modules
folder and redownloading all of my dependencies.