-
Notifications
You must be signed in to change notification settings - Fork 10
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
Better package structure for require commands #104
Comments
I have a few ways to go about it :
The suggestions made by branneman seem better. Of the alternatives given, the alias and startup script seem close to what we are doing in other places in AutolabJS project. Of course, we need to make the alias work with the linting and test setup. |
The problem requirements
|
@ishitamed19 and @mukkachaitanya There is a tutorial on require which is relevant to this issue. Node.js also allows require.resolve() function which allows us to specify the path names of resolution. We can construct the path name based on the view taken from a config file and give that as an option to Also there is now ES6 modules which are supported on Node.js via esm. ES6 modules are like Java packages which provide a nice design flexibility. Another side benefit is the destructuring of necessary named imports from an ES6 module. The only disadvantage vis-a-vis commonJS modules (require()) is that we can't have imports from dynamic paths. Here is a brief summary. |
It might be prudent to just target the following changes.
The rest of the requirements demand deep design changes. We can take them up later. |
The solution of putting something in package.json would limit us from configuring a view. Instead, if we create a require.js in utils which uses the wrapper idea, then we can simply use the following functions.
We can still read the view from configuration and use |
Description
The sub-directories must contain better package.json files so that the
require()
can allow us to directly import the targeted sub-module.Steps to Reproduce
Expected behavior: [What you expect to happen]
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
Additional Information
The text was updated successfully, but these errors were encountered: