Open bramaudi opened 3 years ago
It seems there's some incompatibility going on with caniuse-lite > 1.0.30001195
and browserslist
/babel
/core-js
/something else idk. Through some trial and error, I've found it's not processing the latest JS syntax very well.
I've outlined some steps to demonstrate this, and a workaround using Yarn.
yarn create snowpack-app project --template @snowpack/app-template-blank --use-yarn
cd project
yarn add --dev @snowpack/plugin-webpack
- then add @snowpack/plugin-webpack
to plugin list in snowpack.config.js
yarn build
- Success
// src/index.js
// ES2020 nullish coalescing function greet(input) { return input ?? "Hello world"; }
7. `yarn build` - Fail
8. Using **Yarn**, you can force `caniuse-lite` to a specific version using the `resolutions` field in `package.json`:
```json
"resolutions": {
"caniuse-lite": "1.0.30001195"
}
yarn install
yarn build
- SuccessI don't understand why this is the case, but I hope someone can debug this, it's over my head.
Thanks for your response @denovodavid It seems you're right, maybe my previous dependencies causing a conflict with the new one especially affected the dependencies of snowpack webpack-plugin.
For information, i have try this from new blank snowpack project and its works great!
"resolutions": {
"caniuse-lite": "1.0.30001195"
}
Adding this in package.json fixed the issue
@bramaudi should not this be resolved by snowpack itself rather than us modifying package.json
Ah yes, sure!
Bug Report Quick Checklist
Describe the bug
Error on build after installing these packages:
The error log: https://pastebin.com/5dcVFfPJ
To Reproduce
git clone https://github.com/bramaudi/snowpack-solid-template project
cd project && npm i
npm run build
- this still build successfully of coursenpm install -D tailwindcss@latest postcss@latest autoprefixer@latest
Expected behavior
Webpack successfuly build the production bundle.
Anything else?
After deleting those package by doing
npm r tailwindcss postcss autoprefixer
the error still present, even when deleting the node_modules dir usingrm -rf node_modules
and re-installing packages will give no effect.The only way to get back is clear the project folder then git reset --hard the latest commit / re-clone it. I have no idea to solve it, i mean without doing more configuration.