This makes it so applications using the pipeline can use a node-modules directory thereby enabling the usage of npm for package resolution.
With this approach, the package.json for your project needs to be at the asset root (src/assets or grails-app/assets) and you need to run npm from there.
This means you can do this:
/path/to/project/grails-app/assets $ npm i react
Then you can import the module as if it were an actual Node project.
import React from 'react';
Using the modules in this way makes Intellij able to understand large libraries like React better as well.
This does not use Node or NPM in any way for the build process, only for package management, so things that require an actual Node environment will still need to be built outside of the project.
The groovy-json dependency was not added lightly, but if it needs removed I can try to work around it.
Please let me know if anything needs reworked or improved.
This makes it so applications using the pipeline can use a
node-modules
directory thereby enabling the usage ofnpm
for package resolution.With this approach, the package.json for your project needs to be at the asset root (
src/assets
orgrails-app/assets
) and you need to run npm from there.This means you can do this:
Then you can import the module as if it were an actual Node project.
Using the modules in this way makes Intellij able to understand large libraries like React better as well.
This does not use Node or NPM in any way for the build process, only for package management, so things that require an actual Node environment will still need to be built outside of the project.
The
groovy-json
dependency was not added lightly, but if it needs removed I can try to work around it.Please let me know if anything needs reworked or improved.