You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unable to import from library (ascMain not working?) #1679
I was able to reproduce the bug. I found a work around by explicitly declaring the relative path. Looks like its using the LIBRARY_PREFIX path regardless if its a defined as a USER source library by the parser.ts.
When I follow the reproduction steps, I get a version of aswebglue in node_modules that has "ascMain": "webgl.ts",. Could this be a dependency problem?
If you checkout lume/glas to that hash, you can modify package.json to have the exact hash for the aswebglue dependency, but it should be reproducible even without doing that.
Per @trusktr request, I was able to try to import using import {myExport} from 'my-npm-lib/some-folder-in-the-lib/some-file', and it didn't work for me either in my project:
(Also, as a quick note, I don't require this behavior for my library, just wanted to help @trusktr reporduce, since they had asked 😄 👍 )
Yeah, I tried all approaches. @torch2424 listed one approach (direct file post-fixed onto the library name). But it fails on more approaches:
// ascMain in some-lib is "src/index.js" which re-exports from "./path/to/direct/foo.ts"import{foo}from'some-lib'// errorimport{foo}from'some-lib/src/path/to/direct/foo.ts'// error// With this one I expect it to read `ascMain` from package.json in the `some-lib/` folder,// but I wouldn't be surprised if this particular case hasn't been implemented yet, as// people most likely won't be trying this unless they are working around the original issue.import{foo}from'../../../node_modules/some-lib'// error// This one works:import{foo}from'../../../node_modules/some-lib/src/path/to/direct/foo.ts'// good
I didn't try to remove src/, but my guess is it won't work either.
I'm in Linux. Maybe glfw-raub has an issue on another OS or flavor of Linux.
Let me see about making a reproduction with only one dependency.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!
Activity
p3nGu1nZz commentedon Feb 13, 2021
I was able to reproduce the bug. I found a work around by explicitly declaring the relative path. Looks like its using the LIBRARY_PREFIX path regardless if its a defined as a USER source library by the parser.ts.
work around:
dcodeIO commentedon Feb 14, 2021
When I follow the reproduction steps, I get a version of
aswebglueinnode_modulesthat has"ascMain": "webgl.ts",. Could this be a dependency problem?Also,
src/test.tsdoes not exist.trusktr commentedon Feb 14, 2021
The commit hashes to use are above in the OP links.
lume/glas repo: 8f56ae0bb0d5796d4202fbfab7a352e00bc44600
aswebglue: 9499782e0d7b3b9f51bbe3c7238abf0838f51c71
If you checkout lume/glas to that hash, you can modify package.json to have the exact hash for the
aswebgluedependency, but it should be reproducible even without doing that.Use direct file path until AssemblyScript module resolution is fixed (A…
trusktr commentedon Feb 23, 2021
@dcodeIO simple reproduction:
You will see this output:
trusktr commentedon Feb 23, 2021
Updated the previous comment, the reproduction is reproducible and won't change.
torch2424 commentedon Feb 26, 2021
Per @trusktr request, I was able to try to import using
import {myExport} from 'my-npm-lib/some-folder-in-the-lib/some-file', and it didn't work for me either in my project:(Also, as a quick note, I don't require this behavior for my library, just wanted to help @trusktr reporduce, since they had asked 😄 👍 )
dcodeIO commentedon Feb 26, 2021
@trusktr For some reason the second repro also doesn't work on my machine. Can't install glfw-raub or something.
Btw, did you try if it works if you remove the
/src/from the import? I believe the root directory isdir(ascMain)essentially.trusktr commentedon Feb 27, 2021
@dcodeIO
Yeah, I tried all approaches. @torch2424 listed one approach (direct file post-fixed onto the library name). But it fails on more approaches:
I didn't try to remove
src/, but my guess is it won't work either.I'm in Linux. Maybe
glfw-raubhas an issue on another OS or flavor of Linux.Let me see about making a reproduction with only one dependency.
p3nGu1nZz commentedon Feb 28, 2021
ruab doesnt work on my windows or linux machines either.
Merge branch 'interop-with-node' of github.com:lume/ASWebGLue into up…
JairusSW commentedon Apr 1, 2021
Got the same error... :(
JairusSW commentedon Apr 30, 2021
Hey, @trusktr @torch2424 @ZoeDreams , it seems to be fixed!
github-actions commentedon Jun 2, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!
trusktr commentedon Jul 6, 2021
There's still an issue, so I continued in #1954