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',
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

@ -10,13 +10,10 @@ export default defineConfig({
port: '6006',
},
resolve: {
includes: ['dev-demos']
includes: ['dev-demos'],
},
polyfill: {
imports: [
'element-remove',
'babel-polyfill',
]
imports: ['element-remove', 'babel-polyfill'],
},
targets: {
chrome: 58,
@ -30,17 +27,20 @@ export default defineConfig({
.rule('lint')
.test(/\.glsl$/)
.use('babel')
.loader('ts-shader-loader')
.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'],
],
};