Skip to content

Feature/emotion #70

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

Merged
merged 9 commits into from
Jan 12, 2020
Prev Previous commit
Next Next commit
cleanup config overrides
  • Loading branch information
ShMcK committed Jan 12, 2020
commit e6eaf21a26b74d1a14fee64239df3976d13e8e64
41 changes: 14 additions & 27 deletions web-app/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const path = require('path') // eslint-disable-line
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const { addBabelPreset, addBabelPlugin, addWebpackModuleRule } = require('customize-cra')

module.exports = function override(config) {
config.module.rules.push({
addWebpackModuleRule({
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
Expand All @@ -12,34 +14,19 @@ module.exports = function override(config) {
},
},
],
})
})(config)

config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
plugins: [
// load css for @alifd/next components
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: true,
},
],
],
presets: [
// react-app
['react-app', { flow: false, typescript: true }],
// allow emotion css prop on html
['@emotion/babel-preset-css-prop'],
],
// load @alifd/next component css
addBabelPlugin([
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: true,
},
})
])(config)

config.resolve.extensions.push('.ts', '.tsx')

config.resolve.modules = ['node_modules', path.resolve(__dirname, './src')]
// setup emotion styles
addBabelPreset('@emotion/babel-preset-css-prop')(config)

return config
}