There is two package.json file. What should I do?

Published 1 month ago by memoLee

I have a project builded with laravel and need to add a template. But the template has own package.json node_modules etc.

What is the right way the handling this issue. Any help appreciated.

cmdobueno

Combine the package.json. You really dont have any other choice...

Im sure somewhere there is a cool tool to do it for you, but worst case you just manually merge the two files into a super awesome cool file... then run npm install

nodE_models means nothings, they will get a fresh copy installed.

memoLee

Thank you for your answer. But what about saas and js files of template ?

cmdobueno

Use webpack to merge them?

memoLee

These files not compiled files . Do I need that ?

Cronix
Cronix
1 month ago (783,370 XP)

They don't have to be compiled. All merge does is exactly what it says...merges 2 or more files into a single file. Like I take all of my vendor css files and merge them into a single vendor.css file.

memoLee

Got it but with what ? webpack ? Also how can I merge two of package.json files?

Cronix
Cronix
1 month ago (783,370 XP)

Got it but with what ? webpack ?

Yes, with laravel mix (which uses webpack). https://laravel.com/docs/5.7/mix

But the template has own package.json node_modules etc.

Mind giving a link to that? I've never heard of a package having 2 separate package.json files.

memoLee

You may misunderstood me. I mean one of this is laravel package.json and the other is templates package.json . I added on stackoverflow and it has a snapshot of the app directory of template. Please check it out there.

https://stackoverflow.com/questions/52301950/there-is-two-package-json-file-one-of-this-came-fom-template-what-should-i-do

Please sign in or create an account to participate in this conversation.