diff --git a/packages/plugin-dva/CHANGELOG.md b/packages/plugin-dva/CHANGELOG.md index 512e51ca5..a00e5d0ad 100644 --- a/packages/plugin-dva/CHANGELOG.md +++ b/packages/plugin-dva/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.11.1](https://github.com/umijs/plugins/compare/@umijs/plugin-dva@0.11.0...@umijs/plugin-dva@0.11.1) (2021-04-09) + +### Bug Fixes + +- **dva:** dva model import undefined when from umi ([#523](https://github.com/umijs/plugins/issues/523)) ([1d8fb78](https://github.com/umijs/plugins/commit/1d8fb78e6ccda237307867bb0954fb840c95f930)) + +# [0.11.0](https://github.com/umijs/plugins/compare/@umijs/plugin-dva@0.10.0...@umijs/plugin-dva@0.11.0) (2021-03-26) + +### Features + +- improve dva log ([#562](https://github.com/umijs/plugins/issues/562)) ([4d84817](https://github.com/umijs/plugins/commit/4d84817a041fd259afb6a8c7f6abfac16e7925e5)) + # [0.10.0](https://github.com/umijs/plugins/compare/@umijs/plugin-dva@0.9.1...@umijs/plugin-dva@0.10.0) (2021-01-13) ### Features diff --git a/packages/plugin-dva/package.json b/packages/plugin-dva/package.json index 23596f42e..1297789e2 100644 --- a/packages/plugin-dva/package.json +++ b/packages/plugin-dva/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/plugin-dva", - "version": "0.10.0", + "version": "0.11.1", "description": "@umijs/plugin-dva", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-dva/src/dva.tpl b/packages/plugin-dva/src/dva.tpl index 544faaa32..4be30f721 100644 --- a/packages/plugin-dva/src/dva.tpl +++ b/packages/plugin-dva/src/dva.tpl @@ -4,19 +4,24 @@ import dva from 'dva'; // @ts-ignore import createLoading from '{{{ dvaLoadingPkgPath }}}'; import { plugin, history } from '../core/umiExports'; +{{ ^LazyLoad }} {{{ RegisterModelImports }}} +{{ /LazyLoad }} {{ #dvaImmer }} import dvaImmer, { enableES5 } from '{{{ dvaImmerPath }}}'; {{ /dvaImmer }} let app:any = null; -export function _onCreate(options = {}) { +export {{ #LazyLoad }}async {{ /LazyLoad }}function _onCreate(options = {}) { const runtimeDva = plugin.applyPlugins({ key: 'dva', type: ApplyPluginsType.modify, initialValue: {}, }); + {{ #LazyLoad }} + {{{ RegisterModelImports }}} + {{ /LazyLoad }} app = dva({ history, {{{ ExtendDvaConfig }}} @@ -49,7 +54,13 @@ export class _DvaContainer extends Component { super(props); // run only in client, avoid override server _onCreate() if (typeof window !== 'undefined') { - _onCreate(); + _onCreate() + {{ #LazyLoad }} + .then(() => { + // force update + this.forceUpdate(); + }); + {{ /LazyLoad }} } } @@ -70,6 +81,11 @@ export class _DvaContainer extends Component { render() { const app = getApp(); + {{ #LazyLoad }} + if (!app) { + return null; + } + {{ /LazyLoad }} app.router(() => this.props.children); return app.start()(); } diff --git a/packages/plugin-dva/src/fixtures/lazyLoad/.umirc.ts b/packages/plugin-dva/src/fixtures/lazyLoad/.umirc.ts new file mode 100644 index 000000000..e3e68df1e --- /dev/null +++ b/packages/plugin-dva/src/fixtures/lazyLoad/.umirc.ts @@ -0,0 +1,12 @@ + +export default { + routes: [ + { path: '/', component: 'index' }, + ], + dva: { + lazyLoad: true, + }, + plugins: [ + require.resolve('../../'), + ], +} diff --git a/packages/plugin-dva/src/fixtures/lazyLoad/models/foo.ts b/packages/plugin-dva/src/fixtures/lazyLoad/models/foo.ts new file mode 100644 index 000000000..261afb1ac --- /dev/null +++ b/packages/plugin-dva/src/fixtures/lazyLoad/models/foo.ts @@ -0,0 +1,9 @@ +import { data } from '../utils' + +export default { + state: { + desc: 'foo', + count: 0, + data, + }, +} diff --git a/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.less b/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.less new file mode 100644 index 000000000..ea92bb4cf --- /dev/null +++ b/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.less @@ -0,0 +1,7 @@ + +.normal { +} + +.title { + background: rgb(196, 242, 121); +} diff --git a/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.tsx b/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.tsx new file mode 100644 index 000000000..1ab88084d --- /dev/null +++ b/packages/plugin-dva/src/fixtures/lazyLoad/pages/index.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import styles from './index.less'; +import { connect } from 'dva'; + +export const data = {}; + +export default connect(state => ({ + foo: state.foo, +}))((props) => { + return ( +
+

Page index { props.foo.desc } { props.foo.count }

+
+ ); +}) diff --git a/packages/plugin-dva/src/fixtures/lazyLoad/utils.ts b/packages/plugin-dva/src/fixtures/lazyLoad/utils.ts new file mode 100644 index 000000000..56955c7d5 --- /dev/null +++ b/packages/plugin-dva/src/fixtures/lazyLoad/utils.ts @@ -0,0 +1 @@ +export { data } from './pages/index'; diff --git a/packages/plugin-dva/src/index.test.ts b/packages/plugin-dva/src/index.test.ts index affd21ea4..c5f3b4c18 100644 --- a/packages/plugin-dva/src/index.test.ts +++ b/packages/plugin-dva/src/index.test.ts @@ -38,3 +38,13 @@ test('with-immer', async () => { '

Page index foo 1

', ); }); + +test('lazyLoad', async () => { + const cwd = join(fixtures, 'lazyLoad'); + await generateTmp({ cwd }); + const { container } = render({ cwd }); + await utils.delay(100); + expect(container.innerHTML).toEqual( + '

Page index foo 0

', + ); +}); diff --git a/packages/plugin-dva/src/index.ts b/packages/plugin-dva/src/index.ts index 5806b9b71..010fa185f 100644 --- a/packages/plugin-dva/src/index.ts +++ b/packages/plugin-dva/src/index.ts @@ -33,6 +33,11 @@ export default (api: IApi) => { schema(joi) { return joi.object({ disableModelsReExport: joi.boolean(), + lazyLoad: joi + .boolean() + .description( + 'lazy load dva model avoiding the import modules from umi undefined', + ), extraModels: joi.array().items(joi.string()), hmr: joi.boolean(), immer: joi.alternatives(joi.boolean(), joi.object()), @@ -107,11 +112,15 @@ export default (api: IApi) => { dvaImmerES5: lodash.isPlainObject(api.config.dva?.immer) && api.config.dva?.immer.enableES5, + LazyLoad: api.config.dva?.lazyLoad, RegisterModelImports: models .map((path, index) => { - return `import Model${lodash.upperFirst( + const modelName = `Model${lodash.upperFirst( lodash.camelCase(basename(path, extname(path))), - )}${index} from '${path}';`; + )}${index}`; + return api.config.dva?.lazyLoad + ? `const ${modelName} = (await import('${path}')).default;` + : `import ${modelName} from '${path}';`; }) .join('\r\n'), RegisterModels: models diff --git a/packages/plugin-esbuild/CHANGELOG.md b/packages/plugin-esbuild/CHANGELOG.md index ac03134ff..0cfa02cf1 100644 --- a/packages/plugin-esbuild/CHANGELOG.md +++ b/packages/plugin-esbuild/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.2.0](https://github.com/umijs/plugins/compare/@umijs/plugin-esbuild@1.1.1...@umijs/plugin-esbuild@1.2.0) (2021-04-09) + +### Features + +- **esbuild:** exposes minify pure config ([#575](https://github.com/umijs/plugins/issues/575)) ([ed7f688](https://github.com/umijs/plugins/commit/ed7f688da63e343c330211147d74916c510c504a)) + +## [1.1.1](https://github.com/umijs/plugins/compare/@umijs/plugin-esbuild@1.1.0...@umijs/plugin-esbuild@1.1.1) (2021-03-26) + +### Bug Fixes + +- **esbuild:** minify exposes target config for es5 projects ([#571](https://github.com/umijs/plugins/issues/571)) ([cb93b3a](https://github.com/umijs/plugins/commit/cb93b3a969d9f94c808eda8e02828f347cc2eca0)) + ## [1.0.3](https://github.com/umijs/plugins/compare/@umijs/plugin-esbuild@1.0.2...@umijs/plugin-esbuild@1.0.3) (2020-12-15) ### Bug Fixes diff --git a/packages/plugin-esbuild/package.json b/packages/plugin-esbuild/package.json index ec1c4fb44..f0e1b5eac 100644 --- a/packages/plugin-esbuild/package.json +++ b/packages/plugin-esbuild/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/plugin-esbuild", - "version": "1.1.0", + "version": "1.2.0", "description": "@umijs/plugin-esbuild", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-esbuild/src/fixtures/es5/.umirc.ts b/packages/plugin-esbuild/src/fixtures/es5/.umirc.ts new file mode 100644 index 000000000..057c05492 --- /dev/null +++ b/packages/plugin-esbuild/src/fixtures/es5/.umirc.ts @@ -0,0 +1,22 @@ + +export default { + nodeModulesTransform: { + type: 'none', + }, + targets: { + ie: 11, + }, + history: { + type: 'memory', + options: { + initialEntries: ['/'], + }, + }, + mountElementId: '', + routes: [ + { path: '/', component: 'index' }, + ], + esbuild: { + target: 'es5', + }, +} diff --git a/packages/plugin-esbuild/src/fixtures/es5/src/pages/index.js b/packages/plugin-esbuild/src/fixtures/es5/src/pages/index.js new file mode 100644 index 000000000..4f1f61171 --- /dev/null +++ b/packages/plugin-esbuild/src/fixtures/es5/src/pages/index.js @@ -0,0 +1,3 @@ +export default () => { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") +} diff --git a/packages/plugin-esbuild/src/fixtures/normal/src/pages/index.js b/packages/plugin-esbuild/src/fixtures/normal/src/pages/index.js index 59a8984ec..b93650022 100644 --- a/packages/plugin-esbuild/src/fixtures/normal/src/pages/index.js +++ b/packages/plugin-esbuild/src/fixtures/normal/src/pages/index.js @@ -1,3 +1,5 @@ import React from 'react'; -export default () =>
Hello
+export default () => { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") +} diff --git a/packages/plugin-esbuild/src/index.test.ts b/packages/plugin-esbuild/src/index.test.ts index f10bfd13c..a8f14c75c 100644 --- a/packages/plugin-esbuild/src/index.test.ts +++ b/packages/plugin-esbuild/src/index.test.ts @@ -1,9 +1,11 @@ import { join } from 'path'; -import { existsSync } from 'fs'; +import { existsSync, readFileSync } from 'fs'; import { Service } from 'umi'; const fixtures = join(__dirname, 'fixtures'); +jest.setTimeout(300000); + describe('normal build', () => { let err: any; const cwd = join(fixtures, 'normal'); @@ -27,6 +29,38 @@ describe('normal build', () => { it('normal', () => { expect(err).toBeFalsy(); expect(existsSync(join(cwd, 'dist', 'umi.js'))).toBeTruthy(); + expect(readFileSync(join(cwd, 'dist', 'umi.js'), 'utf8')).toContain( + 'new TypeError(`Invalid attempt to spread non-iterable', + ); + }); +}); + +describe('es5 build', () => { + let err: any; + const cwd = join(fixtures, 'es5'); + beforeAll(async () => { + const service = new Service({ + cwd, + env: 'production', + plugins: [require.resolve('./index.ts')], + }); + let err; + try { + await service.run({ + name: 'build', + }); + } catch (e) { + console.error('es5 build error', e); + err = true; + } + }); + + it('es5', () => { + expect(err).toBeFalsy(); + expect(existsSync(join(cwd, 'dist', 'umi.js'))).toBeTruthy(); + expect(readFileSync(join(cwd, 'dist', 'umi.js'), 'utf8')).toContain( + 'new TypeError("Invalid attempt to spread non-iterable', + ); }); }); diff --git a/packages/plugin-esbuild/src/index.ts b/packages/plugin-esbuild/src/index.ts index ed16cd1eb..3362adec5 100644 --- a/packages/plugin-esbuild/src/index.ts +++ b/packages/plugin-esbuild/src/index.ts @@ -6,7 +6,12 @@ export default (api: IApi) => { key: 'esbuild', config: { schema(joi) { - return joi.object(); + return joi.object({ + target: joi.alternatives( + joi.string(), + joi.array().items(joi.string()), + ), + }); }, }, enableBy: api.EnableBy.config, @@ -14,14 +19,17 @@ export default (api: IApi) => { api.modifyBundleConfig((memo, { type }) => { if (memo.optimization) { + const { target = 'es2015', pure } = api.config.esbuild || {}; const optsMap = { [BundlerConfigType.csr]: { - target: 'es2015', minify: true, + target, + pure, }, [BundlerConfigType.ssr]: { target: 'node10', minify: true, + pure, }, }; const opts = optsMap[type] || optsMap[BundlerConfigType.csr]; diff --git a/packages/plugin-helmet/CHANGELOG.md b/packages/plugin-helmet/CHANGELOG.md index ba48d9c01..ad6e82213 100644 --- a/packages/plugin-helmet/CHANGELOG.md +++ b/packages/plugin-helmet/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.2](https://github.com/umijs/plugins/compare/@umijs/plugin-helmet@1.1.1...@umijs/plugin-helmet@1.1.2) (2021-03-26) + +### Bug Fixes + +- **ssr:** 修复 SSR 下 helmet 无法添加的问题 ([#561](https://github.com/umijs/plugins/issues/561)) ([8072710](https://github.com/umijs/plugins/commit/8072710bb433a109eb01f9d4e56059ff18270592)) + ## [1.1.1](https://github.com/umijs/plugins/compare/@umijs/plugin-helmet@1.1.0...@umijs/plugin-helmet@1.1.1) (2020-08-27) **Note:** Version bump only for package @umijs/plugin-helmet diff --git a/packages/plugin-helmet/package.json b/packages/plugin-helmet/package.json index 296982e7e..1ab98240d 100644 --- a/packages/plugin-helmet/package.json +++ b/packages/plugin-helmet/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/plugin-helmet", - "version": "1.1.1", + "version": "1.1.2", "description": "@umijs/plugin-helmet", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-helmet/src/templates/runtime.tpl b/packages/plugin-helmet/src/templates/runtime.tpl index ad677e2a0..f362b34db 100644 --- a/packages/plugin-helmet/src/templates/runtime.tpl +++ b/packages/plugin-helmet/src/templates/runtime.tpl @@ -21,7 +21,7 @@ if (process.env.__IS_SERVER) { $('head').append(meta); } if (link) { - $('link').append(link); + $('head').append(link); } if (Object.keys(htmlAttributes)) { Object.keys(htmlAttributes).forEach(attrKey => { diff --git a/packages/plugin-locale/CHANGELOG.md b/packages/plugin-locale/CHANGELOG.md index e82356960..54b079c8a 100644 --- a/packages/plugin-locale/CHANGELOG.md +++ b/packages/plugin-locale/CHANGELOG.md @@ -1,38 +1,33 @@ # Change Log -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.10.10](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.9...@umijs/plugin-locale@0.10.10) (2021-03-19) +# [0.11.0](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.10...@umijs/plugin-locale@0.11.0) (2021-04-09) -**Note:** Version bump only for package @umijs/plugin-locale +### Bug Fixes +- to solve the problem that FormattedMessage report [React Intl] Missing message error, it was encountered in the situation when calling addLocale to add/merge translation key-value pairs which were fetched from backend server for current language. ([#573](https://github.com/umijs/plugins/issues/573)) ([e6f5625](https://github.com/umijs/plugins/commit/e6f56255b5df987030dd29468fa67d992036fb78)) +### Features +- **locale:** add 8px margin between icon and label for SelectLang ([#557](https://github.com/umijs/plugins/issues/557)) ([ff99186](https://github.com/umijs/plugins/commit/ff991860d6ce5308d64eca5129583cceec587ea1)) +## [0.10.10](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.9...@umijs/plugin-locale@0.10.10) (2021-03-19) -## [0.10.9](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.8...@umijs/plugin-locale@0.10.9) (2021-03-04) +**Note:** Version bump only for package @umijs/plugin-locale +## [0.10.9](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.8...@umijs/plugin-locale@0.10.9) (2021-03-04) ### Bug Fixes -* useLayoutEffect will be warning in ssr mode ([#533](https://github.com/umijs/plugins/issues/533)) ([2b2c169](https://github.com/umijs/plugins/commit/2b2c16996fd228ecab411d916f8ab255d1982416)) -* when has runtimeLocale.setLocale setLocale not work ([#543](https://github.com/umijs/plugins/issues/543)) ([afc144c](https://github.com/umijs/plugins/commit/afc144c282d0156626432ce167dcf9ac3023ca98)) - - - - +- useLayoutEffect will be warning in ssr mode ([#533](https://github.com/umijs/plugins/issues/533)) ([2b2c169](https://github.com/umijs/plugins/commit/2b2c16996fd228ecab411d916f8ab255d1982416)) +- when has runtimeLocale.setLocale setLocale not work ([#543](https://github.com/umijs/plugins/issues/543)) ([afc144c](https://github.com/umijs/plugins/commit/afc144c282d0156626432ce167dcf9ac3023ca98)) ## [0.10.8](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.7...@umijs/plugin-locale@0.10.8) (2021-01-19) - ### Bug Fixes -* **locale:** unused return statement ([#513](https://github.com/umijs/plugins/issues/513)) ([05251df](https://github.com/umijs/plugins/commit/05251df6e33a58084fcd5b7d36d8e0cb60f7f07e)) - - - - +- **locale:** unused return statement ([#513](https://github.com/umijs/plugins/issues/513)) ([05251df](https://github.com/umijs/plugins/commit/05251df6e33a58084fcd5b7d36d8e0cb60f7f07e)) ## [0.10.7](https://github.com/umijs/plugins/compare/@umijs/plugin-locale@0.10.6...@umijs/plugin-locale@0.10.7) (2021-01-13) diff --git a/packages/plugin-locale/package.json b/packages/plugin-locale/package.json index 9140220c2..ffa04a8f9 100644 --- a/packages/plugin-locale/package.json +++ b/packages/plugin-locale/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/plugin-locale", - "version": "0.10.10", + "version": "0.11.0", "description": "@umijs/plugin-locale", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-locale/src/templates/SelectLang.tpl b/packages/plugin-locale/src/templates/SelectLang.tpl index 9ed9a8dd1..056adc297 100644 --- a/packages/plugin-locale/src/templates/SelectLang.tpl +++ b/packages/plugin-locale/src/templates/SelectLang.tpl @@ -403,12 +403,13 @@ export const SelectLang: React.FC = (props) => { : changeLang; const menuItemStyle = { minWidth: "160px" }; + const menuItemIconStyle = { marginRight: "8px" }; const langMenu = ( {allLangUIConfig.map((localeObj) => { return ( - + {localeObj?.icon || "🌐"} {localeObj?.label || "en-US"} diff --git a/packages/plugin-locale/src/templates/localeExports.tpl b/packages/plugin-locale/src/templates/localeExports.tpl index 636ffbd5e..1520aad09 100644 --- a/packages/plugin-locale/src/templates/localeExports.tpl +++ b/packages/plugin-locale/src/templates/localeExports.tpl @@ -85,6 +85,17 @@ export const addLocale = ( momentLocale: momentLocale, {{#Antd}}antd,{{/Antd}} }; + + // 在通过后台接口异步加载翻译键值对或补充某个语言的翻译时,通知react去替换成包含了最新翻译的intl对象 + // 从而解决在调用addLocale之后,当前语言不变的情况下,FormattedMessage无法更新最新的翻译出现[React Intl] Missing message报错的问题 + if (getLocale() === name) { + event.emit(LANG_CHANGE_EVENT, name); + // chrome 不支持这个事件。所以人肉触发一下 + if (window.dispatchEvent) { + const event = new Event('languagechange'); + window.dispatchEvent(event); + } + } }; /** diff --git a/packages/plugin-openapi/CHANGELOG.md b/packages/plugin-openapi/CHANGELOG.md index 9f253e618..78a3a0501 100644 --- a/packages/plugin-openapi/CHANGELOG.md +++ b/packages/plugin-openapi/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.2.1](https://github.com/umijs/plugins/compare/@umijs/plugin-openapi@1.2.0...@umijs/plugin-openapi@1.2.1) (2021-03-26) + +### Bug Fixes + +- **onpenapi:** openapi support node10 ([#567](https://github.com/umijs/plugins/issues/567)) ([99c5eb0](https://github.com/umijs/plugins/commit/99c5eb06ab92c32a658e6470667f2914a5500965)) + # [1.2.0](https://github.com/umijs/plugins/compare/@umijs/plugin-openapi@1.1.0...@umijs/plugin-openapi@1.2.0) (2021-03-15) ### Features diff --git a/packages/plugin-openapi/package.json b/packages/plugin-openapi/package.json index 406e572c7..dd969bd00 100644 --- a/packages/plugin-openapi/package.json +++ b/packages/plugin-openapi/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/plugin-openapi", - "version": "1.2.0", + "version": "1.2.1", "description": "@umijs/plugin-openapi", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-webpack-5/CHANGELOG.md b/packages/plugin-webpack-5/CHANGELOG.md deleted file mode 100644 index 32d8caa5c..000000000 --- a/packages/plugin-webpack-5/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.3](https://github.com/umijs/plugins/compare/@umijs/plugin-webpack-5@0.1.2...@umijs/plugin-webpack-5@0.1.3) (2020-02-29) - -### Bug Fixes - -- **plugin-webpack-5:** add polyfilles for node ([968da50](https://github.com/umijs/plugins/commit/968da504483d2de3409ac070159ecf79954dc9b9)) - -## [0.1.2](https://github.com/umijs/plugins/compare/@umijs/plugin-webpack-5@0.1.1...@umijs/plugin-webpack-5@0.1.2) (2020-02-17) - -**Note:** Version bump only for package @umijs/plugin-webpack-5 - -## [0.1.1](https://github.com/umijs/plugins/compare/@umijs/plugin-webpack-5@0.1.0...@umijs/plugin-webpack-5@0.1.1) (2020-02-04) - -**Note:** Version bump only for package @umijs/plugin-webpack-5 - -# 0.1.0 (2020-02-04) - -### Bug Fixes - -- **plugin-webpack-5:** add jsnext:main to resolve.mainFields ([1aeb90d](https://github.com/umijs/plugins/commit/1aeb90d863a6cf95b5ec08ae42cbc58b85f55bdb)) -- **plugin-webpack-5:** mini-css-extract-plugin's peerDependencies problem ([5b92aa2](https://github.com/umijs/plugins/commit/5b92aa2644f9df7a8505702ea16a6dfe415b1d21)) - -### Features - -- **plugin-webpack-5:** change cache directory to .umi/.cache ([63270b7](https://github.com/umijs/plugins/commit/63270b774acbdd252477e1a7cf8bc6f9e261db24)) -- implement plugin-model ([734e5d6](https://github.com/umijs/plugins/commit/734e5d6264628376ac0219e97f434693db61e9d5)) -- plugin-locale ([b884b75](https://github.com/umijs/plugins/commit/b884b7568eb7f677bc5a8341b8d7c52c252f7c6a)) -- plugin-webpack-5 ([28ea059](https://github.com/umijs/plugins/commit/28ea059eb7983b045940fefd1e2e129bebbbc972)) diff --git a/packages/plugin-webpack-5/README.md b/packages/plugin-webpack-5/README.md deleted file mode 100644 index df4d94b8d..000000000 --- a/packages/plugin-webpack-5/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @umijs/plugin-webpack-5 - -> @umijs/plugin-webpack-5. - -See our website [@umijs/plugin-webpack-5](https://umijs.org/plugins/plugin-webpack-5) for more information. - -## Install - -Using npm: - -```bash -$ npm install --save-dev @umijs/plugin-webpack-5 -``` - -or using yarn: - -```bash -$ yarn add @umijs/plugin-webpack-5 --dev -``` diff --git a/packages/plugin-webpack-5/package.json b/packages/plugin-webpack-5/package.json deleted file mode 100644 index 65d336bb6..000000000 --- a/packages/plugin-webpack-5/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@umijs/plugin-webpack-5", - "version": "0.1.3", - "description": "@umijs/plugin-webpack-5", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "files": [ - "lib", - "src" - ], - "repository": { - "type": "git", - "url": "https://github.com/umijs/plugins" - }, - "keywords": [ - "umi" - ], - "authors": [ - "chencheng (https://github.com/sorrycc)" - ], - "license": "MIT", - "bugs": "https://github.com/umijs/plugins/issues", - "homepage": "https://github.com/umijs/plugins/tree/master/packages/plugin-webpack-5#readme", - "peerDependencies": { - "umi": "3.x" - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "mini-css-extract-plugin": "0.9.0", - "tty-browserify": "0.0.1", - "url": "0.11.0", - "webpack": "5.0.0-beta.12" - } -} diff --git a/packages/plugin-webpack-5/src/index.ts b/packages/plugin-webpack-5/src/index.ts deleted file mode 100644 index 4bf64a03d..000000000 --- a/packages/plugin-webpack-5/src/index.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { IApi } from 'umi'; -import { join } from 'path'; -// @ts-ignore -import webpack from 'webpack'; - -// ref: -// https://blog.logrocket.com/new-features-in-webpack-5-2559755adf5e/ -// https://webpack.js.org/migrate/5/ -// https://github.com/webpack/webpack/issues/9802 -// https://github.com/webpack/changelog-v5/blob/master/guides/persistent-caching.md -export default (api: IApi) => { - api.describe({ - config: { - schema(joi) { - return joi.object(); - }, - }, - }); - - api.modifyBundleConfigOpts(memo => { - memo.miniCSSExtractPluginPath = require.resolve('mini-css-extract-plugin'); - memo.miniCSSExtractPluginLoaderPath = require.resolve( - 'mini-css-extract-plugin/dist/loader', - ); - return memo; - }); - - api.modifyBundleImplementor(() => { - return webpack; - }); - - api.modifyBundleConfig(memo => { - // futureEmitAssets is enabled by default - delete memo.output?.futureEmitAssets; - - // webpack 5 has no node polyfill - delete memo.node; - - // url polyfill for mini-css-extract-plugin's dep - memo.resolve!.modules?.push(join(__dirname, '../node_modules')); - - // antd-pro 的依赖里,intl-messageformat 用了 jsnext:main - memo.resolve!.mainFields = ['browser', 'module', 'jsnext:main', 'main']; - - // polyfills - memo.resolve!.alias!.tty = require.resolve('tty-browserify'); - - // cache - memo.cache = { - type: 'filesystem', - buildDependencies: {}, - cacheDirectory: join(api.paths.absTmpPath!, '.cache', 'webpack'), - }; - - return memo; - }); - - api.modifyDefaultConfig(memo => { - // dev 模式开启 styleLoader,因为 mini-css-extract-plugin 和 webpack@5 的物理缓存有冲突 - if (api.env === 'development') { - memo.styleLoader = {}; - } - return memo; - }); -}; diff --git a/packages/preset-react/CHANGELOG.md b/packages/preset-react/CHANGELOG.md index 554e473cf..7034b05ee 100644 --- a/packages/preset-react/CHANGELOG.md +++ b/packages/preset-react/CHANGELOG.md @@ -1,15 +1,18 @@ # Change Log -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [1.8.2](https://github.com/umijs/plugins/compare/@umijs/preset-react@1.8.1...@umijs/preset-react@1.8.2) (2021-03-19) +## [1.8.4](https://github.com/umijs/plugins/compare/@umijs/preset-react@1.8.3...@umijs/preset-react@1.8.4) (2021-04-09) **Note:** Version bump only for package @umijs/preset-react +## [1.8.3](https://github.com/umijs/plugins/compare/@umijs/preset-react@1.8.2...@umijs/preset-react@1.8.3) (2021-03-26) +**Note:** Version bump only for package @umijs/preset-react +## [1.8.2](https://github.com/umijs/plugins/compare/@umijs/preset-react@1.8.1...@umijs/preset-react@1.8.2) (2021-03-19) +**Note:** Version bump only for package @umijs/preset-react ## [1.8.1](https://github.com/umijs/plugins/compare/@umijs/preset-react@1.8.0...@umijs/preset-react@1.8.1) (2021-03-15) diff --git a/packages/preset-react/package.json b/packages/preset-react/package.json index 269c94a39..efee80dee 100644 --- a/packages/preset-react/package.json +++ b/packages/preset-react/package.json @@ -1,6 +1,6 @@ { "name": "@umijs/preset-react", - "version": "1.8.2", + "version": "1.8.4", "description": "@umijs/preset-react", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -32,11 +32,11 @@ "@umijs/plugin-analytics": "0.2.2", "@umijs/plugin-antd": "0.9.1", "@umijs/plugin-crossorigin": "1.2.0", - "@umijs/plugin-dva": "0.10.0", - "@umijs/plugin-helmet": "1.1.1", + "@umijs/plugin-dva": "0.11.1", + "@umijs/plugin-helmet": "1.1.2", "@umijs/plugin-initial-state": "2.3.0", "@umijs/plugin-layout": "0.14.1", - "@umijs/plugin-locale": "0.10.10", + "@umijs/plugin-locale": "0.11.0", "@umijs/plugin-model": "2.5.6", "@umijs/plugin-request": "2.5.2", "@umijs/plugin-test": "1.0.0"