Skip to content
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

Handle node build in sub directories with ddc (missing packages link) #23

Open
alextekartik opened this issue May 14, 2018 · 4 comments

Comments

@alextekartik
Copy link
Contributor

Thanks a lot for your work. I have a small issue where if I create a subdirectory (in example), the resulting dart.js don't work in build (bad path to packages or missing packages link. I don't know if it is on purpose or not.

Le me explain the step to reproduce it in this repo

If i do

pub run build_runner build --output build/
node build/example/console_example.dart.js

everything works fine.

Now let's create a sub directory in example and copy console_example.dart (we have a file build/example/sub/console_example.dart'

If i do

pub run build_runner build --output build/

dart.js and node.ddc.js are compiled fine. however

node build/example/sub/console_example.dart.js

throws

annot find module '/media/files/local/dev/external/git/github.com/pulyaevskiy/node-interop/node_interop/build/example/sub/packages/$sdk/dev_compiler/common/dart_sdk'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)

Indeed the build/example/sub/packages link does not exist.

To note that if I build with dart2js

pub run build_runner build --output build/ --define="build_node_compilers|entrypoint=compiler=dart2js"
node build/example/sub/console_example.dart.js

it works fine

@shinayser
Copy link

I am having this excatly same problem and have no clue how to solve that. Anyone can give a clue of how to make this work?

@pulyaevskiy
Copy link
Owner

Note that DDC support hasn't been very stable overall. I'd be curious to learn about use cases where people think DDC is crucial.

I haven't had a real need for DDC myself and this is why I haven't given it a lot of attention.

@shinayser
Copy link

DDC is important for debugging and also important if you want to generate a javascript library, to be used by other people in other contexts, since the javascript generated by DDC is perfectly readable by humans.

@pulyaevskiy
Copy link
Owner

Note that DDC is a dev compiler, it wasn’t meant to be used in production environment, so publishing a library from DDC output may not be the best option.

Also it is still possible to debug with dart2js, if minification is turned off. Not as convenient as having code in separate js files but still.

So far I it looks like the only benefit of ddc in this context is a better debugging experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants