viankakrisna
10/7/2017 - 11:17 AM

CRA preact-compat + styled-components

CRA preact-compat + styled-components

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');
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');