-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: switch from react-app-rewired to craco
- Loading branch information
Showing
3 changed files
with
760 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import NodePolyfillPlugin from "node-polyfill-webpack-plugin"; | ||
import { Configuration } from "webpack/types.d"; | ||
|
||
const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin"); | ||
|
||
const config = { | ||
babel: { | ||
plugins: ["@emotion/babel-plugin"], | ||
}, | ||
webpack: { | ||
plugins: [new NodePolyfillPlugin()], | ||
configure: (webpackConfig: Configuration) => { | ||
if (!webpackConfig?.resolve?.plugins) return webpackConfig; | ||
|
||
// Allow imports outside of src/ | ||
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter( | ||
({ constructor }: InstanceType<typeof ModuleScopePlugin>) => constructor?.name !== "ModuleScopePlugin", | ||
); | ||
return webpackConfig; | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
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
Oops, something went wrong.