Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update https://registry.npm.taobao.org to https://registry.npmmirror.com #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<a name="4.4.5"></a>
## [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))



<a name="4.4.4"></a>
## [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))



<a name="4.4.3"></a>
## [4.4.3](https://github.com/easy-team/easywebpack-react/compare/4.4.2...4.4.3) (2019-06-26)

Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -41,15 +44,15 @@ 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

- Install Command Line

```bash
$ npm i easywebpack-cli -g
$ npm i @easy-team/easywebpack-cli -g
```

- Initalize Application
Expand All @@ -69,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({
Expand Down Expand Up @@ -102,13 +105,13 @@ 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);
// build file to disk
easywebpack.build(webpackConfig);

```

## Example

Expand Down
17 changes: 9 additions & 8 deletions config/plugin/react-ssr-dynamic-chunk-webpack-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand All @@ -36,4 +37,4 @@ class ReactSSRDynamicChunkPlugin {
}
}

module.exports = ReactSSRDynamicChunkPlugin;
module.exports = ReactSSRDynamicChunkPlugin;
3 changes: 3 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "easywebpack-react",
"version": "4.4.3",
"version": "4.4.5",
"description": "React client render and server side render build solution for Webpack",
"keywords": [
"webpack",
"easywebpack",
"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",
Expand All @@ -39,7 +40,7 @@
"test": "nyc --reporter=html --reporter=text mocha --timeout=1000000",
"cov": "nyc report --reporter=lcov && codecov --token=71d430b6-cb87-49b2-a156-2c55cd181ba4",
"ci": "npm run lint && npm run cov",
"ii": "npm install --registry https://registry.npm.taobao.org"
"ii": "npm install --registry https://registry.npmmirror.com"
},
"files": [
"index.js",
Expand Down