Hope you guys are having a great end-of-year! I've got a question that I'm sure is a bonehead mistake I'm making, but here goes...
We're creating a new module in our system and are looking to use some NPM or Yarn packages as a part of it.
In the root of the module
, we installed NPM and then installed the packages that we want to install.
So far, so good.
But then we went to import or require the library from
and no bueno.
At first, we do a simple 'require' statement at the top of the file (before
and get a 404 error. File not found at client/src/{package}.
So we then update the 'require' statement to
and get a 403 Forbidden.
So, my question...what is the appropriate way to include an NPM package in a new/custom module?
Does "import" work the same way?
If we want to use ES6 classes, should require/import statements be in the class extension or before "define?"
We're creating a new module in our system and are looking to use some NPM or Yarn packages as a part of it.
In the root of the module
Code:
(client/custom/modules/module-name)
So far, so good.
But then we went to import or require the library from
Code:
client/custom/modules/module-name/src/views/model/model-detail-view.js
At first, we do a simple 'require' statement at the top of the file (before
Code:
`define(....`)
So we then update the 'require' statement to
Code:
require("../../../custom/modules/module-name/node_modules/{package}")
So, my question...what is the appropriate way to include an NPM package in a new/custom module?
Does "import" work the same way?
If we want to use ES6 classes, should require/import statements be in the class extension or before "define?"