-
Notifications
You must be signed in to change notification settings - Fork 910
Open
Description
Quick checklist
- I am using the latest version of Snowpack and all plugins.
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the bug
I tried to install babel plugin to use jsx inside of .js files in my project.
since I'm extremely familiar and comfortable with the webpack and most of my files are in .js format.
but after installing babel and adding it to my config.mjs file. it gives me the error I've mentioned in the title.
it points to index.ts but I've never changed that file and in fact, whenever I remove babel plugin from my config.mjs file, the issue, goes away.
I wish there could be a built-in support to write jsx in js.
Steps to reproduce
npx create-snowpack-app new-dir --template @snowpack/app-template-react-typescriptnpm install --save-dev @snowpack/plugin-babelnpm install --save-dev @babel/preset-reactnpm install --save-dev @babel/plugin-transform-react-jsx- setting up the
snowpack.config.mjs
/** @type {import("snowpack").SnowpackUserConfig } */
export default {
mount: {
public: { url: '/', static: true },
src: { url: '/dist' },
},
plugins: [
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-dotenv',
['@snowpack/plugin-babel'],
[
'@snowpack/plugin-typescript',
{
/* Yarn PnP workaround: see https://www.npmjs.com/package/@snowpack/plugin-typescript */
...(process.versions.pnp ? { tsc: 'yarn pnpify tsc' } : {}),
},
],
],
routes: [
/* Enable an SPA Fallback in development: */
// {"match": "routes", "src": ".*", "dest": "/index.html"},
],
optimize: {
/* Example: Bundle your final build: */
// "bundle": true,
},
packageOptions: {
/* ... */
},
devOptions: {
/* ... */
},
buildOptions: {
/* ... */
},
};
- setting up
.babelrcconfig:
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-transform-react-jsx"]
}
- placing
.bablercin the root directory:
Link to minimal reproducible example (optional)
No response
Metadata
Metadata
Assignees
Labels
No labels

