Closed gwhitney closed 4 years ago
Thanks for the ticket. I suspect this could be a rollup or buble issue where it is expecting all imports at the top of the file without detecting that it is an import function call. I can try to debug a little later. Just to confirm, are you using the latest version of Luna (1.5.0)? I recently updated all the dependencies to their latest versions as well as Chromium so not sure if it could be fixed there. Or maybe it broke as a result of that change.
I use dynamic script loading a bunch on my projects with Luna, but using my own method vs. the import
method so it could def just be a bug.
Okay I am able to reproduce in 1.5.0. Seems to be a Luna issue. Will keep you updated on a fix
Turned out to be an issue with buble after all. The dynamic import function was not added until Chrome 63. I will publish a new version of luna to npm with the fix in a few.
One thing to note is that I am not sure if the ./
path is not going to work for a resolution in a luna context. You can try using --node
to have it run in node mode, but if you need it to run in a browser you may have to change the path to /node_modules/three...
, but it may work. I didn’t have a build of three there to test that
I have a file externals.js in my project (externals.txt) that is responsible for loading third-party modules (and falling back to my cached copies if the CDN is not accessible). If I open node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome and load a page that imports externals.js, it works fine. However, when I run luna on this file, I get the following output
Is this a problem with Luna, or is there something I am doing wrong? I can't make any sense of why "import" is an unexpected token here since clearly the version of chromium being used supports dynamic import. Thanks for any suggestions/fixes to Luna/etc.