Skip to content

Commit

Permalink
Merge pull request #683 from umijs/feat/webpack-4
Browse files Browse the repository at this point in the history
[WIP] feat: migrate to webpack@4
  • Loading branch information
sorrycc authored Jul 6, 2018
2 parents cbf5aeb + e2feca7 commit b235e34
Show file tree
Hide file tree
Showing 123 changed files with 1,884 additions and 2,928 deletions.
16 changes: 0 additions & 16 deletions packages/af-webpack/CHANGELOG.md

This file was deleted.

46 changes: 0 additions & 46 deletions packages/af-webpack/Configuration.md

This file was deleted.

79 changes: 0 additions & 79 deletions packages/af-webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,11 @@

Unique webpack wrapper for ant financial.

## Why af-webpack ?

TODO

## CLIs based on af-webpack

* [umi](https://github.com/umijs/umi)
* [roadhog@2](https://github.com/sorrycc/roadhog/tree/2.0)

## Configuration

See [./Configuration.md](./Configuration.md).

## API

### af-webpack/getConfig

Get webpack config with opts.

```js
const webpackConfig = getConfig(opts);
// use webpackConfig to dev or build
```

### af-webpack/dev

Run webpack-dev-server more gracefully with [react-dev-utils](https://github.com/facebookincubator/create-react-app/tree/master/packages/react-dev-utils).

```js
dev({
webpackConfig,
extraMiddlewares,
beforeServer,
afterServer,
onCompileDone,
onCompileInvalid,
proxy,
});
```

webpackConfig is required, other optional.

Options:

* `webpackConfig`: The webpack config
* `extraMiddlewares`: Extra middlewares for webpack-dev-server, based on express
* `beforeServer`: The function to execute before dev server is started
* `afterServer`: The function to execute after dev server is started
* `onCompileDone`
* `onCompileInvalid`
* `proxy`: The proxy config which will pass through to webpack-dev-server

### af-webpack/build

Run webpack compilation.

```js
build({
webpackConfig,
success,
});
```

webpackConfig is required, other optional.

Options:

* `webpackConfig`: the webpack config
* `success`: the function to execute after build is done successfully

### af-webpack/react-dev-utils

The APIs related to react-dev-utils.

* webpackHotDevClientPath:the real path of webpackHotDevClient

### af-webpack/webpack

The webpack, useful to register extra webpack plugins.

### af-webpack/registerBabel

Register babel for extra files.

## LICENSE

MIT
38 changes: 38 additions & 0 deletions packages/af-webpack/bin/af-webpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node

const getConfig = require('../getConfig');
const getUserConfig = require('../getUserConfig');

const cwd = process.cwd();
const webpackConfig = getWebpackConfig();

switch (process.argv[2]) {
case 'dev':
require('../dev').default({
cwd,
webpackConfig,
});
break;
case 'build':
require('../build').default({
cwd,
webpackConfig,
});
break;
default:
console.error(`Unknown command ${process.argv[2]}`);
process.exit(1);
}

function getWebpackConfig() {
const { config: userConfig } = getUserConfig({
cwd,
});
return getConfig.default({
...userConfig,
cwd,
entry: {
index: './index.js',
},
});
}
51 changes: 24 additions & 27 deletions packages/af-webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "af-webpack",
"version": "0.22.10",
"bin": {
"af-webpack": "./bin/af-webpack.js"
},
"dependencies": {
"@babel/core": "7.0.0-beta.46",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.46",
"@babel/register": "7.0.0-beta.46",
"@babel/runtime": "7.0.0-beta.46",
"assert": "^1.4.1",
"autoprefixer": "^8.2.0",
"awesome-typescript-loader": "^3.4.1",
"awesome-typescript-loader": "^5.2.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^8.0.0-beta.0",
"babel-plugin-add-module-exports": "^0.2.1",
Expand All @@ -17,55 +20,49 @@
"case-sensitive-paths-webpack-plugin": "^2.1.1",
"chalk": "^2.1.0",
"chokidar": "^2.0.3",
"clipboardy": "^1.2.3",
"copy-webpack-plugin": "^4.2.0",
"css-loader": "^0.28.7",
"debug": "^3.1.0",
"deprecate": "^1.0.0",
"detect-port": "^1.2.1",
"didyoumean": "^1.2.1",
"es5-imcompatible-versions": "^0.1.2",
"eslint": "^4.7.1",
"eslint-config-umi": "^0.1.4",
"eslint-loader": "^2.0.0",
"eslint-plugin-flowtype": "^2.34.1",
"eslint-plugin-import": "^2.6.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.1.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"file-loader": "^1.1.11",
"fork-ts-checker-webpack-plugin": "^0.4.1",
"hard-source-webpack-plugin": "^0.6.7",
"html-webpack-plugin": "^2.30.1",
"inquirer": "^3.3.0",
"friendly-errors-webpack-plugin": "^1.7.0",
"hard-source-webpack-plugin": "^0.10.1",
"inquirer": "^6.0.0",
"is-plain-object": "^2.0.4",
"is-root": "^1.0.0",
"less": "^2.7.2",
"is-root": "^2.0.0",
"less": "^3.0.4",
"less-loader": "^4.0.5",
"lodash.isequal": "^4.5.0",
"mini-css-extract-plugin": "^0.4.1",
"pkg-up": "^2.0.0",
"postcss": "^6.0.11",
"postcss-flexbugs-fixes": "^3.2.0",
"postcss-loader": "^2.0.6",
"progress-bar-webpack-plugin": "^1.11.0",
"react-dev-utils": "^5.0.0",
"react-error-overlay": "^3.0.0",
"react-error-overlay": "^4.0.0",
"requireindex": "^1.1.0",
"resolve": "^1.5.0",
"semver": "^5.5.0",
"sockjs-client": "1.1.4",
"strip-ansi": "3.0.1",
"sockjs-client": "1.1.5",
"strip-ansi": "4.0.0",
"strip-json-comments": "^2.0.1",
"style-loader": "^0.20.3",
"sw-precache-webpack-plugin": "^0.11.4",
"style-loader": "^0.21.0",
"system-bell-webpack-plugin": "^1.0.0",
"tslint": "^5.8.0",
"tslint-loader": "^3.5.3",
"typescript": "^2.8.1",
"url-loader": "^0.6.2",
"webpack": "^3.5.6",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.4",
"webpack-manifest-plugin": "^1.3.2"
"url-loader": "^1.0.1",
"webpack": "^4.8.2",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-chain": "^4.8.0",
"webpack-dev-server": "^3.1.4",
"webpack-manifest-plugin": "^2.0.3",
"webpack-merge": "^4.1.2"
},
"repository": {
"type": "git",
Expand All @@ -81,7 +78,7 @@
"devDependencies": {
"glob": "^7.1.2",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6"
"sass-loader": "^7.0.3"
},
"files": [
"lib",
Expand Down
Loading

0 comments on commit b235e34

Please sign in to comment.