From d499425bc54c63c87ba0bc1f9bcfd39eb613913f Mon Sep 17 00:00:00 2001 From: sky Date: Thu, 1 Aug 2019 16:03:11 +0800 Subject: [PATCH 1/8] fix: react-hot-loader console warning --- lib/client.js | 3 +++ package.json | 9 +++++---- test/client.test.js | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/client.js b/lib/client.js index 2c75c0e..4e6e172 100644 --- a/lib/client.js +++ b/lib/client.js @@ -4,6 +4,9 @@ const WebpackReactBaseBuilder = require('./base'); class WebpackClientBuilder extends WebpackReactBaseBuilder(EasyWebpack.WebpackClientBuilder) { constructor(config = {}) { super(config); + if (this.dev) { + this.setAlias('react-dom', '@hot-loader/react-dom', false) + } } createHotEntry() { diff --git a/package.json b/package.json index 4eb15a8..8ed1f93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easywebpack-react", - "version": "4.4.3", + "version": "4.4.4", "description": "React client render and server side render build solution for Webpack", "keywords": [ "webpack", @@ -8,12 +8,13 @@ "react" ], "dependencies": { - "easywebpack": "^4.9.0", + "@hot-loader/react-dom": "^16.8.6", "babel-preset-react": "^6.24.1", + "easywebpack": "^4.9.0", "eslint-plugin-react": "^7.1.0", - "react-hot-loader": "^4.3.5", + "isomorphic-style-loader": "^4.0.0", "react-entry-template-loader": "^1.0.0", - "isomorphic-style-loader": "^4.0.0" + "react-hot-loader": "^4.3.5" }, "devDependencies": { "chai": "^4.0.0", diff --git a/test/client.test.js b/test/client.test.js index 26a1a08..07979e1 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -88,7 +88,7 @@ describe('client.test.js', () => { it('should dev hot test', () => { const builder = createBuilder({ env: 'dev', log: true }); const webpackConfig = builder.create(); - expect(webpackConfig.entry['client.test'].length).to.equal(4); + expect(webpackConfig.entry['client.test'].length).to.equal(3); }); it('should html test', () => { const builder = createBuilder({ From da1ecbe63a2913f199121b7b53a42dca531037b8 Mon Sep 17 00:00:00 2001 From: sky Date: Thu, 1 Aug 2019 16:03:37 +0800 Subject: [PATCH 2/8] Release 4.4.4 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac90254..de7b82c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [4.4.4](https://github.com/easy-team/easywebpack-react/compare/4.4.3...4.4.4) (2019-08-01) + + +### Bug Fixes + +* react-hot-loader console warning ([d499425](https://github.com/easy-team/easywebpack-react/commit/d499425)) + + + ## [4.4.3](https://github.com/easy-team/easywebpack-react/compare/4.4.2...4.4.3) (2019-06-26) From 0f2febfced4bed54c1ee3ececa1f3042ac209aea Mon Sep 17 00:00:00 2001 From: sky Date: Sat, 3 Aug 2019 16:21:43 +0800 Subject: [PATCH 3/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6efa39..b59bf09 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ const webpackTool = new WebpackTool(); easywebpack.server(webpackConfig); // build file to disk easywebpack.build(webpackConfig); - +``` ## Example From 1ecc0b7ab77c687bf14269673cf4aef4c047cdae Mon Sep 17 00:00:00 2001 From: sky Date: Sun, 13 Oct 2019 17:32:34 +0800 Subject: [PATCH 4/8] doc: update version description --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b59bf09..6738025 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,6 @@ React client render and server side render build solution for Webpack -- easywebpack-react ^4.x.x > webpack 4.x.x -- easywebpack-react ^3.x.x > webpack 3.x.x - ## Featues - ✔︎ React Client Render and Server Side Render Build Mode @@ -33,6 +30,12 @@ React client render and server side render build solution for Webpack - ✔︎ ES5/ES6/ES7, TypeScript, DLL, Css Module, Dynamic Import, AntD Dynamic Import - ✔︎ Powerful Tool Chain [easywebpack-cli](https://github.com/easy-team/easywebpack-cli) +## Version + +- @easy-team/easywebpack-react ^4.x.x > Webpack 4.x.x + Babel 7 +- easywebpack-react ^4.x.x > Webpack 4.x.x + Babel 6 +- easywebpack-react ^3.x.x > Webpack 3.x.x + Babel 6 + ## Documents - https://www.yuque.com/easy-team/easywebpack @@ -41,7 +44,7 @@ React client render and server side render build solution for Webpack ## Install ```bash -$ npm i easywebpack-react --save-dev +$ npm i @easy-team/easywebpack-react --save-dev ``` ## QuickStart @@ -49,7 +52,7 @@ $ npm i easywebpack-react --save-dev - Install Command Line ```bash -$ npm i easywebpack-cli -g +$ npm i @easy-team/easywebpack-cli -g ``` - Initalize Application From ab66874bd8134e386cb773a8f24214a7be53b05c Mon Sep 17 00:00:00 2001 From: sky Date: Sun, 13 Oct 2019 17:35:15 +0800 Subject: [PATCH 5/8] doc: update plugin require --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6738025..23f5230 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ $ npm start ### Write Webpack Config `webpack.config.js` ```js -const easywebpack = require('easywebpack-react'); +const easywebpack = require('@easy-team/easywebpack-react'); const webpack = easywebpack.webpack; const merge = easywebpack.merge; const webpackConfig = easywebpack.getWebpackConfig({ @@ -105,7 +105,7 @@ webpack --config webpack.config.js ```js const webpackConfig = require('./webpack.config.js'); -const easywebpack = require('easywebpack-react'); +const easywebpack = require('@easy-team/easywebpack-react'); const webpackTool = new WebpackTool(); // development mode easywebpack.server(webpackConfig); From 05b407fa0a9d728c488b47e5bb39b2e797463fd6 Mon Sep 17 00:00:00 2001 From: sky Date: Wed, 20 Nov 2019 19:53:50 +0800 Subject: [PATCH 6/8] fix: https://github.com/easy-team/egg-react-webpack-boilerplate/issues/44 --- .../index.js | 17 +++++++++-------- test/client.test.js | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/config/plugin/react-ssr-dynamic-chunk-webpack-plugin/index.js b/config/plugin/react-ssr-dynamic-chunk-webpack-plugin/index.js index 29752a8..3a45c76 100644 --- a/config/plugin/react-ssr-dynamic-chunk-webpack-plugin/index.js +++ b/config/plugin/react-ssr-dynamic-chunk-webpack-plugin/index.js @@ -11,21 +11,22 @@ class ReactSSRDynamicChunkPlugin { apply(compiler) { compiler.hooks.emit.tap('ReactSSRDynamicChunkPlugin', (compilation, callback) => { const buildPath = compilation.options.output.path; - - if (!fs.existsSync(buildPath)) { - mkdirp.sync(buildPath); - } - compilation.chunks.forEach(chunk => { if (!this.opts.chunk) { return; } + const chunks = chunk.files || []; const asyncChunks = chunk.getAllAsyncChunks(); - + const mainChunkFile = chunks.length > 0 ? chunks[0] : null; + const mainChunkDir = mainChunkFile ? path.dirname(mainChunkFile) : null; asyncChunks && asyncChunks.forEach(asyncChunk => { asyncChunk.files.forEach(filename => { - const filepath = path.join(buildPath, filename); + const filepath = mainChunkDir ? path.join(buildPath, mainChunkDir, filename) : path.join(buildPath, filename); + const filedir = path.dirname(filepath); + if (!fs.existsSync(filedir)) { + mkdirp.sync(filedir); + } const source = compilation.assets[filename].source(); fs.writeFileSync(filepath, source, 'utf8'); }); @@ -36,4 +37,4 @@ class ReactSSRDynamicChunkPlugin { } } -module.exports = ReactSSRDynamicChunkPlugin; +module.exports = ReactSSRDynamicChunkPlugin; \ No newline at end of file diff --git a/test/client.test.js b/test/client.test.js index 07979e1..26a1a08 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -88,7 +88,7 @@ describe('client.test.js', () => { it('should dev hot test', () => { const builder = createBuilder({ env: 'dev', log: true }); const webpackConfig = builder.create(); - expect(webpackConfig.entry['client.test'].length).to.equal(3); + expect(webpackConfig.entry['client.test'].length).to.equal(4); }); it('should html test', () => { const builder = createBuilder({ From 17bb68f4b801e2bd8ea8f016f8c6237c307bf896 Mon Sep 17 00:00:00 2001 From: sky Date: Wed, 20 Nov 2019 19:56:55 +0800 Subject: [PATCH 7/8] Release 4.4.5 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de7b82c..73c7093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [4.4.5](https://github.com/easy-team/easywebpack-react/compare/4.4.4...4.4.5) (2019-11-20) + + +### Bug Fixes + +* https://github.com/easy-team/egg-react-webpack-boilerplate/issues/44 ([05b407f](https://github.com/easy-team/easywebpack-react/commit/05b407f)) + + + ## [4.4.4](https://github.com/easy-team/easywebpack-react/compare/4.4.3...4.4.4) (2019-08-01) diff --git a/package.json b/package.json index 8ed1f93..c68b681 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easywebpack-react", - "version": "4.4.4", + "version": "4.4.5", "description": "React client render and server side render build solution for Webpack", "keywords": [ "webpack", From feadc71f444de4c2a93cc8759d449369086cf216 Mon Sep 17 00:00:00 2001 From: Morgan Date: Thu, 4 Aug 2022 08:53:30 +0800 Subject: [PATCH 8/8] feat: add renderClient .tsx support --- lib/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base.js b/lib/base.js index a8ab2ed..5d748ab 100644 --- a/lib/base.js +++ b/lib/base.js @@ -69,7 +69,7 @@ const WebpackReactBaseBuilder = WebpackBuilder => class extends WebpackBuilder { } prepareEntry(entries) { - return super.prepareEntry(entries, { loader: 'react-entry-template-loader', match: '.jsx' }); + return super.prepareEntry(entries, { loader: 'react-entry-template-loader', match: /(\.jsx)|(\.tsx)/ }); } }; module.exports = WebpackReactBaseBuilder; \ No newline at end of file