Skip to content

Commit

Permalink
change example to show use of DeclarationFilesPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ath0mas committed Oct 14, 2020
1 parent 62eaefc commit 1dfe21d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ typings/
/node_modules
/.idea
/dist
/example/dist
/.vscode
*.iml
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ npm i -D @ns0m/witty-webpack-declaration-files

## Typescript - tsconfig.json
```
{ ...
declaration: true,
{
...
compilerOptions: {
...
declaration: true
}
}
```

Expand Down
9 changes: 5 additions & 4 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"start": "webpack-dev-server --mode development --progress --color"
},
"devDependencies": {
"ts-loader": "^5.0.0",
"typescript": "^3.0.0",
"webpack": "^4.0.0",
"webpack-cli": "^3.0.0",
"@ns0m/witty-webpack-declaration-files": "file:..",
"ts-loader": "8.0.5",
"typescript": "4.0.3",
"webpack": "4.44.2",
"webpack-cli": "3.3.12",
"webpack-dev-server": "^3.1.14"
}
}
4 changes: 3 additions & 1 deletion example/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import render = require('./render');

render();
render();

export let hi = 'Hello World!';
3 changes: 2 additions & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"sourceMap": true
"sourceMap": true,
"declaration": true
}
}
8 changes: 7 additions & 1 deletion example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
const path = require('path');
const DeclarationFilesPlugin = require('@ns0m/witty-webpack-declaration-files');

module.exports = {
devtool: 'inline-source-map',
Expand All @@ -18,5 +19,10 @@ module.exports = {
},
resolve: {
extensions: [ '.ts', '.tsx', '.js' ]
}
},
plugins: [
new DeclarationFilesPlugin({
merge: true
})
]
};

0 comments on commit 1dfe21d

Please sign in to comment.