|
1 |
| -const{ addLessLoader, addBabelPreset}=require('customize-cra') |
| 1 | +constpath=require('path')// eslint-disable-line |
2 | 2 |
|
3 | 3 | module.exports=functionoverride(config){
|
4 |
| -addBabelPreset('@emotion/babel-preset-css-prop')(config) |
| 4 | +config.module.rules.push({ |
| 5 | +test:/\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, |
| 6 | +use:[ |
| 7 | +{ |
| 8 | +loader:'file-loader', |
| 9 | +options:{ |
| 10 | +name:'[name].[ext]', |
| 11 | +outputPath:'fonts/', |
| 12 | +}, |
| 13 | +}, |
| 14 | +], |
| 15 | +}) |
| 16 | + |
| 17 | +config.module.rules.push({ |
| 18 | +test:/\.(ts|tsx)$/, |
| 19 | +loader:require.resolve('babel-loader'), |
| 20 | +options:{ |
| 21 | +plugins:[ |
| 22 | +// load css for@alifd/next components |
| 23 | +[ |
| 24 | +'babel-plugin-import', |
| 25 | +{ |
| 26 | +libraryName:'@alifd/next', |
| 27 | +style:true, |
| 28 | +}, |
| 29 | +], |
| 30 | +], |
| 31 | +presets:[ |
| 32 | +// react-app |
| 33 | +['react-app',{flow:false,typescript:true}], |
| 34 | +// allow emotion css prop on html |
| 35 | +['@emotion/babel-preset-css-prop'], |
| 36 | +], |
| 37 | +}, |
| 38 | +}) |
| 39 | + |
| 40 | +config.resolve.extensions.push('.ts','.tsx') |
| 41 | + |
| 42 | +config.resolve.modules=['node_modules',path.resolve(__dirname,'./src')] |
5 | 43 |
|
6 | 44 | returnconfig
|
7 | 45 | }
|