Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
feat(demo): update watch argument
Browse files Browse the repository at this point in the history
  • Loading branch information
seognil committed Apr 24, 2020
1 parent 360fe3c commit bc522cd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { isWatch } from './../utils/env';
import { ConfigTweaker } from '../utils/types';

export const loadScript: ConfigTweaker = (config, resolver) => {
config.watch(isWatch);
};
2 changes: 2 additions & 0 deletions demo/17-milestone-with-framework/config/webpack/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export const isBuilding = dev || prod;
export const shouldMinify = prod;

export const sourcemap = argv.devtool !== undefined ? argv.devtool : isDevMode;

export const isWatch = argv.watch !== undefined;
2 changes: 1 addition & 1 deletion demo/17-milestone-with-framework/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scripts": {
"start": "cross-env TS_NODE_PROJECT=config/tsconfig-for-webpack-config.json webpack-dev-server --open --config=config/webpack/webpack.server.ts",
"build": "npm run build:prod",
"build": "npm run build:prod --",
"build:dev": "cross-env TS_NODE_PROJECT=config/tsconfig-for-webpack-config.json webpack --config=config/webpack/webpack.dev.ts",
"build:prod": "cross-env TS_NODE_PROJECT=config/tsconfig-for-webpack-config.json webpack --config=config/webpack/webpack.prod.ts",
"test": "open dist/index.html"
Expand Down
1 change: 1 addition & 0 deletions demo/17-milestone-with-framework/src/features/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './load-async-dynamic';
import './load-esnext';
import './load-es2020';
import './load-npm';
21 changes: 21 additions & 0 deletions demo/17-milestone-with-framework/src/features/load-es2020.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
const def = 42;
const data = null ?? def;
console.warn('nullish', data);
}

{
type Struct = {
arr?: number[];
cb?: Function;
};

let inst: Struct = {
cb: () => 233,
};

const cbRes = inst.cb?.();
const arrRes = inst.arr?.[0];

console.warn(cbRes, arrRes);
}
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ _还没写文档的_
- [14-pack-image](demo/14-pack-image)
- [15-react](demo/15-react)
- [16-vue](demo/16-vue)
- [17-milestone-with-framework](demo/17-milestone-with-framework)

<!-- demo end -->

Expand Down

0 comments on commit bc522cd

Please sign in to comment.