-
-
Save bluwy/18b8d103cea5f823a95c4ce39d36a048 to your computer and use it in GitHub Desktop.
VIte preset plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default defineConfig({ | |
plugins: [preactPreset()], | |
}) | |
function preactPreset({ devtoolsInProd }) { | |
return [ | |
{ | |
name: 'preact-preset', | |
enforce: 'pre', | |
config: () => ({ | |
esbuild: { | |
jsxFactory: 'h', | |
jsxFragment: 'Fragment', | |
jsxInject: `import { h, Fragment } from 'preact'`, | |
}, | |
resolve: { | |
alias: { | |
'react-dom/test-utils': 'preact/test-utils', | |
'react-dom': 'preact/compat', | |
react: 'preact/compat', | |
}, | |
}, | |
}), | |
}, | |
preactDevtoolsPlugin({ injectInProd: devtoolsInProd }), | |
prefresh(), | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment