-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pkg cannot resolve JSON modules #34
Comments
It appears This is strange, why is it missing there... I found this through adding:
Into the
|
This means pkg config cannot solve this problem. This has to do with the fact that
|
It appears that Even though we are using the same command: node2nixDev = (import (node2nixDrv true) { inherit pkgs nodejs; }).package.override (attrs: {
src = src;
buildInputs = attrs.buildInputs ++ [ nodePackages.node-gyp-build ];
dontNpmInstall = true;
postInstall = ''
# The dependencies were prepared in the install phase
# See `node2nix` generated `node-env.nix` for details.
npm run build
echo '-------------AFTER BUILD-----------------'
ls .
echo 'SHOW DIST'
ls dist
echo 'SHOW SRC'
ls src
echo 'JSON IS MISSING!?!?'
# This call does not actually install packages. The dependencies
# are present in `node_modules` already. It creates symlinks in
# $out/lib/node_modules/.bin according to `bin` section in `package.json`.
npm install
'';
});
|
For some reason, the |
I'm going to check if the |
The According to https://stackoverflow.com/a/59419449/582917 and also the docs for
See the However this seems weird because The other important thing to realise is that JSON files that are required or just referenced other ways will not be automatically copied over unless they are This means a more robust solution for importing JSON files in The solution ends up using https://github.com/swimauger/tsc-hooks to hook in and copy over all the other files that tsc doesn't resolve. This actually can help solve the copying over the protobuf files. Currently we're doing:
Inside For now, I think adding If we have other asset files that need to be copied into Another a good suggestion is to have "assets" outside of Of course the problem is that sometimes we would consider non-js, non-ts files to be "source" files. Other times they are liek images, which can be stored outside the |
@tegefaulkes @joshuakarp beware of this. To help catch future errors like this, we need automated tests that run post-CI/CD build of the executables. Which is to be addressed in MatrixAI/Polykey#231 |
Commented upstream in typescript regarding this problem: microsoft/TypeScript#30835 (comment) |
Describe the bug
When doing
nix-build ./release.nix -A package.linux.x64.elf
or any of the executable builds, it results in:The
test.json
is currently insrc/test.json
which is imported bysrc/utils.ts
.The TSC compiles it properly and we see that
src/test.json
is indist/test.json
.Even if I add
dist/test.json
toassets
orscripts
it doesn't work. And the resulting executable throws aMODULE_NOT_FOUND
error.To Reproduce
nix-build ./release.nix -A package.linux.x64.elf
Expected behavior
The
pkg
should be bundling thetest.json
as normal.Note that
package.json
does not appear to be a problem.The text was updated successfully, but these errors were encountered: