Closed rubenmoya closed 1 year ago
This looks related to the following nuxt issue. https://github.com/nuxt/nuxt.js/issues/11970
A workaround for this is transpiling @vanilla-extract
, outdent
, & @emotion
like this:
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
vite: {
plugins: [
vanillaExtractPlugin(),
]
},
build: {
transpile: ['@vanilla-extract', 'outdent', '@emotion']
}
})
Repo (part of my ssr issue, nuxt/nuxt.js#11827)
I have a similar issue when I try to integrate vanilla extract
. I get a slightly different error even when I try to add the plugin with what's above ☝🏼.
Error: couldn't find parent package.json with a name field
. Anyone has any fix for this as yet?
I have a similar issue when I try to integrate
vanilla extract
. I get a slightly different error even when I try to add the plugin with what's above ☝🏼. Error:couldn't find parent package.json with a name field
. Anyone has any fix for this as yet?
@leithonenglish This error can be resolved by adding "name": "my-app"
(or whatever name you choose) to your project's package.json
. Vanilla Extract looks for the package name to prepend to the virtual modules it creates.
That works perfectly but now when I try to import any of the styles, for example,
app.css.ts
import { style } from "@vanilla-extract/css";
export const wrapperStyle = style({
background: `red`,
});
app.vue
<script lang="ts" setup>
import { wrapperStyle } from "./app.css";
</script>
<template>
<div :class="wrapperStyle">Hey there</div>
</template>
I get the following warning (node:43589) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
and the server never loads the page.
I tried getting info from here https://v3.nuxtjs.org/guide/going-further/esm/ but still not sure what I am missing
No updates on this?
I get the following warning (node:43589) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. and the server never loads the page.
I think I'm facing the same issue with SvelteKit. Someone commented that Node does not like .esm.js
and it should be eg. vanilla-extract-css.mjs
.
noExternal
used to work, but that does not seem to be the case anymore.
Renaming the file to end with .mjs
seems to get rid of the errors. Here's another one suggesting fixing the extension.
Okay, my error seems to be fixed by updating to Vite 4.0.3 released 5 hours ago, heh. I guess it was this one.
Anyway, .mjs
should be used over .esm.js
, or .cjs
over .cjs.js
, and css-what
should be upgraded to v6 so it is ESM, not CJS.
I just tested this and don't seem to get any errors. If nobody has anything to add here, I'd close this issue.
Describe the bug
Nuxt 3 beta has been released and I was trying to use vanilla-extrat with it. I installed the vite plugin and added it to the
nuxt.config.ts
file. After runningyarn dev
I get this error:Let me know if there is any more information I can give you.
Link to reproduction
https://codesandbox.io/s/nuxt3-vanilla-extract-cpfce
System Info
Output of
npx envinfo --system --npmPackages @vanilla-extract/css,@vanilla-extract/webpack-plugin,@vanilla-extract/esbuild-plugin,@vanilla-extract/vite-plugin,@vanilla-extract/sprinkles,webpack,esbuild,vite --binaries --browsers
: