laravel - Importing node_modules from a dedicated Node.js project - Stack Overflow

I am currently Using Laravel 10 (I know it's outdated and I will upgrade asap), and I have node_mo

I am currently Using Laravel 10 (I know it's outdated and I will upgrade asap), and I have node_modules folder inside the project because i installed some npm modules that I need.

But I need to move the node_modules to a separate Node.js-only project and somehow make the Laravel project use the node_modules from there.

Right now the structure is:

laravel-project
    |______node_modules
              |________some-module
              |________some-other-module

But I need it to be:

laravel-project
nodejs-project
    |______node_modules
              |________some-module
              |________some-other-module

Is such thing possible?

I am currently Using Laravel 10 (I know it's outdated and I will upgrade asap), and I have node_modules folder inside the project because i installed some npm modules that I need.

But I need to move the node_modules to a separate Node.js-only project and somehow make the Laravel project use the node_modules from there.

Right now the structure is:

laravel-project
    |______node_modules
              |________some-module
              |________some-other-module

But I need it to be:

laravel-project
nodejs-project
    |______node_modules
              |________some-module
              |________some-other-module

Is such thing possible?

Share Improve this question asked Mar 31 at 9:28 pileuppileup 3,3025 gold badges30 silver badges69 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Yes, you can move your node modules to outside of the project and symlink it via
going into your laravel project and
ln -s /path/to/node_modules node_modules

This approach should minimize the need for adjustments in paths

Another way you can achieve it is by setting up your vite or mix to reference a folder outside of the project.

There are a few other ways, all dealing with configuration paths.

I do have to mention that I really don't recommend doing it as the idea of laravel is to wrap your project completely, and if you do this you will need to do it in any project you might want to launch or move anywhere.

If you do decide you want to take such an approach, don't fet to change those sources anywhere (especially if you're running the project with Docker).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743956978a4535964.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信