Created
October 7, 2017 11:17
-
-
Save viankakrisna/55ed3a23787ae9aaeae6d88000fef028 to your computer and use it in GitHub Desktop.
CRA preact-compat + styled-components
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
process.env.NODE_ENV = 'production'; | |
const config = require('react-scripts/config/webpack.config.prod'); | |
config.module.rules[1].oneOf[1].options.plugins = [ | |
'babel-plugin-styled-components', | |
]; | |
config.resolve.alias['react'] = 'preact-compat'; | |
config.resolve.alias['react-dom'] = 'preact-compat'; | |
// Not necessary unless you consume a module using `createClass` | |
config.resolve.alias['create-react-class'] = | |
'preact-compat/lib/create-react-class'; | |
require('react-scripts/scripts/build'); |
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
process.env.NODE_ENV = 'development'; | |
const config = require('react-scripts/config/webpack.config.dev'); | |
config.module.rules[1].oneOf[1].options.plugins = [ | |
'babel-plugin-styled-components', | |
]; | |
config.resolve.alias['react'] = 'preact-compat'; | |
config.resolve.alias['react-dom'] = 'preact-compat'; | |
// Not necessary unless you consume a module using `createClass` | |
config.resolve.alias['create-react-class'] = | |
'preact-compat/lib/create-react-class'; | |
require('react-scripts/scripts/start'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment