Skip to content

Commit 1d51de8

Browse files
committed
Resolve conflicts
1 parent 8b4123d commit 1d51de8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/content/configuration/configuration-languages.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ and then proceed to write your configuration:
2626
__webpack.config.ts__
2727

2828
```typescript
29-
import * as webpack from 'webpack';
30-
import * as path from 'path';
29+
import path from 'path';
30+
import webpack from 'webpack';
3131

3232
const config: webpack.Configuration = {
3333
entry: './foo.js',
@@ -40,6 +40,8 @@ const config: webpack.Configuration = {
4040
export default config;
4141
```
4242

43+
Above sample assumes version >= 2.7 or newer of TypeScript is used with the new `esModuleInterop` and `allowSyntheticDefaultImports` compiler options in your `tsconfig.json` file.
44+
4345
Note that you'll also need to check your `tsconfig.json` file. If the module in `compilerOptions` in `tsconfig.json` is `commonjs`, the setting is complete, else webpack will fail with an error. This occurs because `ts-node` does not support any module syntax other than `commonjs`.
4446

4547
There are two solutions to this issue:

src/content/guides/tree-shaking.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ module.exports = {
172172
};
173173
```
174174
175+
T> Note that the `--optimize-minimize` flag can be used to insert the `UglifyJSPlugin` as well.
176+
175177
With that squared away, we can run another `npm run build` and see if anything has changed.
176178
177179
Notice anything different about `dist/bundle.js`? Clearly the whole bundle is now minified and mangled, but, if you look carefully, you won't see the `square` function included but will see a mangled version of the `cube` function (`function r(e){return e*e*e}n.a=r`). With minification and tree shaking our bundle is now a few bytes smaller! While that may not seem like much in this contrived example, tree shaking can yield a significant decrease in bundle size when working on larger applications with complex dependency trees.

0 commit comments

Comments
 (0)