mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
feat: swc/css
This commit is contained in:
parent
749f1d7df2
commit
0d51dd6c3a
@ -35,7 +35,6 @@
|
||||
"@babel/preset-env": "^7.16.4",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@fesjs/utils": "3.0.0-rc.2",
|
||||
"@swc/core": "^1.3.24",
|
||||
"@vue/babel-plugin-jsx": "^1.1.1",
|
||||
"autoprefixer": "^10.2.4",
|
||||
"babel-loader": "^8.2.2",
|
||||
@ -45,7 +44,8 @@
|
||||
"connect-history-api-fallback": "^1.6.0",
|
||||
"copy-webpack-plugin": "^7.0.0",
|
||||
"css-loader": "^5.0.1",
|
||||
"css-minimizer-webpack-plugin": "^3.0.0",
|
||||
"css-minimizer-webpack-plugin": "^4.0.0",
|
||||
"swc-loader": "^0.2.3",
|
||||
"html-webpack-plugin": "^5.0.0",
|
||||
"html-webpack-tags-plugin": "^3.0.0",
|
||||
"less": "3.9.0",
|
||||
@ -56,8 +56,6 @@
|
||||
"postcss-loader": "^4.2.0",
|
||||
"postcss-safe-parser": "^6.0.0",
|
||||
"style-loader": "^2.0.0",
|
||||
"swc-loader": "^0.2.3",
|
||||
"swc-plugin-vue-jsx": "^0.2.0",
|
||||
"vue-loader": "^16.1.2",
|
||||
"webpack": "^5.69.0",
|
||||
"webpack-bundle-analyzer": "^4.4.0",
|
||||
|
@ -10,6 +10,7 @@
|
||||
// 根据 entry 将文件输出到不同的文件夹
|
||||
|
||||
import { deepmerge } from '@fesjs/utils';
|
||||
import { CssMinimizerPlugin } from 'css-minimizer-webpack-plugin';
|
||||
|
||||
function createRules({ isDev, webpackConfig, config, lang, test, loader, options, browserslist, styleLoaderOption }) {
|
||||
function applyLoaders(rule, cssLoaderOption = {}) {
|
||||
@ -97,7 +98,7 @@ export default function createCssWebpackConfig({ isDev, config, webpackConfig, b
|
||||
chunkFilename: '[id].[contenthash:8].css',
|
||||
},
|
||||
]);
|
||||
webpackConfig.optimization.minimizer('css').use(require.resolve('css-minimizer-webpack-plugin'), [{}]);
|
||||
webpackConfig.optimization.minimizer('css').use(require.resolve('css-minimizer-webpack-plugin'), [{ minify: CssMinimizerPlugin.swcMinify }]);
|
||||
}
|
||||
|
||||
return (options) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
export function buildSwcOptions(browserslist, config, isJsx, isTs) {
|
||||
return {
|
||||
const result = {
|
||||
env: {
|
||||
targets: browserslist,
|
||||
mode: 'entry',
|
||||
@ -10,11 +10,12 @@ export function buildSwcOptions(browserslist, config, isJsx, isTs) {
|
||||
syntax: isTs ? 'typescript' : 'ecmascript',
|
||||
jsx: isJsx,
|
||||
},
|
||||
experimental: {
|
||||
plugins: [['swc-plugin-vue-jsx', {}]],
|
||||
},
|
||||
},
|
||||
minify: true,
|
||||
...config.swcLoader,
|
||||
};
|
||||
if (isJsx) {
|
||||
result.jsc.parser.experimental.plugins = (result.jsc.parser.experimental.plugins || []).push(['swc-plugin-vue-jsx', {}]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -59,6 +59,8 @@
|
||||
"@fesjs/plugin-pinia": "^3.0.0-rc.0",
|
||||
"@fesjs/plugin-watermark": "^3.0.0-rc.0",
|
||||
"@fesjs/fes-design": "^0.7.0",
|
||||
"swc-plugin-vue-jsx": "^0.2.0",
|
||||
"@swc/core": "^1.3.24",
|
||||
"vue": "^3.2.37",
|
||||
"vuex": "^4.0.0",
|
||||
"pinia": "^2.0.11"
|
||||
|
Loading…
x
Reference in New Issue
Block a user