build: worker 内联打包添补 (#1338)

This commit is contained in:
lvisei 2022-09-15 10:18:25 +08:00 committed by GitHub
parent 7d796a1940
commit 3e7ab354ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 47 deletions

View File

@ -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'],
],
};

View File

@ -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: [

View File

@ -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'],
],
};