维生素@3.1.6
@vitejs/插件React@2.1.6
@情绪/React@11.10.4React@17.0.2
我的vite配置
{
plugins: [
react({
exclude: /\.stories\.(t|j)sx?$/,
babel: {
plugins: ["@emotion/babel-plugin"]
}
}),
tsconfigPaths(),
svgrPlugin()
],
esbuild: {
logOverride: { "this-is-undefined-in-esm": "silent" },
jsxFactory: `jsx`,
jsxImportSource: "@emotion/react",
},
build: {
outDir: "build",
},
server: {
port: 3000,
},
optimizeDeps: {
esbuildOptions: {
define: {
// Node.js global to browser globalThis
global: "globalThis",
},
plugins: [
// Enable esbuild polyfill plugins
NodeGlobalsPolyfillPlugin({
buffer: true,
}),
],
},
},
resolve: {
preserveSymlinks: true,
dedupe: ["react", "react-dom", "@emotion/styled", "@emotion/core"],
alias: [
{
// this is required for the scss modules
find: /^~(.*)$/,
replacement: '$1',
},
{
find: "@emotion/core",
replacement: getRootPackageDir("@emotion/react"),
},
{
find: "emotion-theming",
replacement: getRootPackageDir("@emotion/react"),
},
{
find: "@emotion/styled",
replacement: getRootPackageDir("@emotion/styled"),
},
],
}
}
这css prop风格似乎不再是这应用到任何组件任何更多.因为我有多个版本的情感(10在依赖,和11在这项目本身)我别名一切到我的根依赖
1条答案
按热度按时间7cwmlq891#
按照此article,似乎您的配置应该更改为
到这个
而不是作为
esbuild
配置的一部分