Skip to content

Remove 'type' from default package.json #49

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

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Conversation

erikgreasy
Copy link
Member

Laravel added default "type": "module" to their package.json in PR: laravel/vite-plugin#189. This breaks compilation with laravel-mix and therefore we need to remove this line from package.json in the installation process. The ability to compile with Vite shouldn't be affected by this, however some specific modules (like svelte) can be affected by this, as mentioned in the Laravel's PR. We think that the potential problem with specific libraries should be resolved by developer that uses them.

Laravel added default "type": "module" to their package.json in PR: laravel/vite-plugin#189. This breaks compilation with laravel-mix and therefore we need to remove this line from package.json in the installation process. The ability to compile with Vite shouldn't be affected by this, however some specific modules (like svelte) can be affected by this, as mentioned in the Laravel's PR. We think that the potential problem with specific libraries should be resolved by developer that uses them.
Copy link
Contributor

@timoransky timoransky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good solution in my opinion. But to summarize: Laravel uses "type": "module" in the package.json since certain version and that doesn't work with Craftable. So we remove it during Craftable installation. Only edge case that comes to my mind is istalling Craftable into existing Laravel10 project, where the developer already makes the use of "type": "module" and this change would break his FE. Right? But I don't really see any other way to install Craaftable, so I think we would just need to add a warning in the docs, or something like that.

@erikgreasy erikgreasy merged commit 98dc228 into master Oct 26, 2023
@erikgreasy erikgreasy deleted the fix/vite-package-type branch October 26, 2023 14:08
@erikgreasy erikgreasy restored the fix/vite-package-type branch October 26, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants