From 3e7ab354acd4bbbbe7af9a767f2934c73db424f8 Mon Sep 17 00:00:00 2001 From: lvisei Date: Thu, 15 Sep 2022 10:18:25 +0800 Subject: [PATCH] =?UTF-8?q?build:=20worker=20=E5=86=85=E8=81=94=E6=89=93?= =?UTF-8?q?=E5=8C=85=E6=B7=BB=E8=A1=A5=20(#1338)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .fatherrc.ts | 20 ++++++------------- .umirc.ts | 40 ++++++++++++++++++------------------- packages/utils/.fatherrc.ts | 18 +++++------------ 3 files changed, 31 insertions(+), 47 deletions(-) diff --git a/.fatherrc.ts b/.fatherrc.ts index 4fcef6f664..0f65a935f7 100644 --- a/.fatherrc.ts +++ b/.fatherrc.ts @@ -1,31 +1,23 @@ export default { // more father 4 config: https://github.com/umijs/father-next/blob/master/docs/config.md esm: { - output:'es' + output: 'es', }, cjs: { - output:'lib' + output: 'lib', }, - transformer:'babel', + transformer: 'babel', autoprefixer: { browsers: ['IE 11', 'last 2 versions'], }, - extraBabelPresets: [ - '@babel/preset-typescript' - ], + extraBabelPresets: ['@babel/preset-typescript'], extraBabelPlugins: [ // 开发模式下以原始文本引入,便于调试 [ // import glsl as raw text 'babel-plugin-inline-import', - { - extensions: [ - '.glsl' - ] - } - ], - [ - 'transform-import-css-l7' + { extensions: ['.glsl'] }, ], + ['transform-import-css-l7'], ], }; diff --git a/.umirc.ts b/.umirc.ts index e74913e700..729bfd9f97 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -5,42 +5,42 @@ export default defineConfig({ favicon: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png', logo: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png', outputPath: 'docs-dist', - base:'/', - devServer:{ - port:'6006', + base: '/', + devServer: { + port: '6006', }, resolve: { - includes: ['dev-demos'] + includes: ['dev-demos'], }, polyfill: { - imports: [ - 'element-remove', - 'babel-polyfill', - ] + imports: ['element-remove', 'babel-polyfill'], }, targets: { chrome: 58, ie: 11, }, mode: 'site', - esbuild:false, - chainWebpack:(memo, { env, webpack, createCSSRule })=> { + esbuild: false, + chainWebpack: (memo, { env, webpack, createCSSRule }) => { // 设置 alias memo.module - .rule('lint') + .rule('lint') .test(/\.glsl$/) .use('babel') - .loader('ts-shader-loader') - // 还可以创建具名use (loaders) + .loader('ts-shader-loader'); + // 还可以创建具名use (loaders) }, - extraBabelPresets:[ - '@babel/preset-typescript' + extraBabelPresets: ['@babel/preset-typescript'], + extraBabelIncludes: [ + '@umijs/preset-dumi', + 'split-on-first', + 'query-string', + 'strict-uri-encode', + 'copy-text-to-clipboard', ], - extraBabelIncludes: ['@umijs/preset-dumi','split-on-first','query-string','strict-uri-encode','copy-text-to-clipboard'], extraBabelPlugins: [ - [ - 'transform-import-css-l7' - ], + ['transform-import-css-l7'], + ['babel-plugin-inline-import', { extensions: ['.worker.js'] }], ], navs: [ null, @@ -54,7 +54,7 @@ export default defineConfig({ 'react-dom': 'window.ReactDOM', antd: 'window.antd', lodash: '_', - fetch:"window.fetch" + fetch: 'window.fetch', }, links: ['https://gw.alipayobjects.com/os/lib/antd/4.16.13/dist/antd.css'], scripts: [ diff --git a/packages/utils/.fatherrc.ts b/packages/utils/.fatherrc.ts index 1bb7f40993..0851572648 100644 --- a/packages/utils/.fatherrc.ts +++ b/packages/utils/.fatherrc.ts @@ -1,30 +1,22 @@ export default { // more father 4 config: https://github.com/umijs/father-next/blob/master/docs/config.md esm: { - output:'es' + output: 'es', }, cjs: { - output:'lib' + output: 'lib', }, autoprefixer: { browsers: ['IE 11', 'last 2 versions'], }, - extraBabelPresets: [ - '@babel/preset-typescript' - ], + extraBabelPresets: ['@babel/preset-typescript'], extraBabelPlugins: [ // 开发模式下以原始文本引入,便于调试 [ // import glsl as raw text 'babel-plugin-inline-import', - { - extensions: [ - '.glsl' - ] - } - ], - [ - 'transform-import-css-l7' + { extensions: ['.glsl', '.worker.js'] }, ], + ['transform-import-css-l7'], ], };