-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRA Example #23
Comments
Good suggestion, thanks Austin. |
Hey @amcdnl and @patrick-fs, thanks for sharing this. I also have a CRA app that is using Craco, I followed your instructions by adding the snippet above to craco.config.js, however it didn't work, I'm not able to see the Shouldn't I also add a rule object to the // webpack.config.js
module = {
rules: [{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
plugins: [
// This is the local reference @fullstory/babel-plugin-annotate-react
// To use in your projects you would replace '../..' with '@fullstory/babel-plugin-annotate-react'
'../..',
isEnvDevelopment &&
shouldUseReactRefresh &&
require.resolve('react-refresh/babel'),
].filter(Boolean),
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
compact: isEnvProduction,
},
}]
} |
It would be worth showing how to set this up with CRA ( create-react-app ).
It can be accomplished by using craco ( https://github.com/gsoft-inc/craco < tailwind also suggests this approach for their custom stuff you have to add ). Then the code just looks like:
craco.config.js
The text was updated successfully, but these errors were encountered: