增加 linaria css in js支持。
$ npm install @remax/plugin-linaria linaria @linaria/shaker @linaria/babel-preset --save
$ yarn add @remax/plugin-linaria linaria @linaria/shaker @linaria/babel-preset
const linaria = require('@remax/plugin-linaria');
module.exports = {
plugins: [linaria({
sourceMap: process.env.NODE_ENV !== 'production', // 生产环境不打印sourceMap
})],
};
module.exports = {
presets: [
['remax', {
framework: 'react',
ts: true
}],
'@linaria' // 添加到 babel-preset
]
}
module.exports = {
rules: [
{
action: require('@linaria/shaker').default,
},
{
test: /node_modules[\/\\](?!remax)/,
action: "ignore"
}
]
}