P
P
pqgg7nwkd42018-07-22 15:25:53
npm
pqgg7nwkd4, 2018-07-22 15:25:53

How to make a shared folder with scripts when using webpack?

Good afternoon.
No matter how I tried it, it doesn't work right.
There is a folder with common scripts (let's say /common_js). There is nothing inside it except the js files themselves. es6 style import/export - with the appropriate keywords.
There are multiple projects:
/projects/project1
/projects/project2
...
Inside each project is a package.json file, node_modules folder, webpack.config.babel.js etc.
I want any project including webpack. config.babel.js, you could use a shared folder like this import ... from 'common_js/foo/bar'. Pay attention to the bold text, it's important. I want to use this same folder in the webpack.config.babel.js config file itself.
At the same time, I don’t really want my node_modules to be in this folder. I want each project to have its own folder and all the necessary modules to be loaded into the node_modules folder of the project.
And, of course, I want the environment (idea) to accept this folder normally.
What I just did not try, I'm already exhausted. Nothing helps. Even symlinks don't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Bodrov, 2018-08-17
@dagen

2ality.com/2018/04/npm-install-directory.html - in the one-to-one article example, your case, except that the names of the directories are different.
And I don’t know how this idea will be perceived. You may need to add the directory where common_js is located to NODE_PATH: https://nodejs.org/api/modules.html#modules_loadin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question