build_node_compilers 0.3.1 build_node_compilers: ^0.3.1 copied to clipboard
Builders wrapping DDC and dart2js compilers configured to output Node modules.
This library provides builders for compiling Dart code to Node-compatible
dart2js compilers are supported.
This package is intended to be used as a development dependency for users
node_interop libraries. Simply add the following to your
dev_dependencies: build_runner: # needed to run the build build_node_compilers:
build.yaml file in your project with following contents:
targets: $default: sources: - "node/**" - "test/**" # Include this if you want to compile tests. - "example/**" # Include this if you want to compile examples.
To build your project run following:
pub run build_runner build --output=build/
Note that for projects using node_interop packages the convention is to put main application files (Dart files containing
mainfunction) in the top-level
node/directory. (This is to avoid confusion (and filename collisions) with apps targeting browsers in
web/and package-level binaries in
bin/recognized by Pub).
By default, the
dartdevc compiler is used, which is the Dart Development
If you would like to opt into
dart2js you will need to override
option to build_runner which would look something like this:
pub run build_runner build \ --define="build_node_compilers|entrypoint=compiler=dart2js" \ --output=build/