From 1dfe21d05bf22d9ec8927baa92f26b6fa7092e11 Mon Sep 17 00:00:00 2001 From: Alexis THOMAS Date: Thu, 15 Oct 2020 01:18:32 +0200 Subject: [PATCH] change example to show use of DeclarationFilesPlugin --- .gitignore | 1 + README.md | 7 +++++-- example/package.json | 9 +++++---- example/src/index.ts | 4 +++- example/tsconfig.json | 3 ++- example/webpack.config.js | 8 +++++++- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index fb411df..acad5f6 100644 --- a/.gitignore +++ b/.gitignore @@ -63,5 +63,6 @@ typings/ /node_modules /.idea /dist +/example/dist /.vscode *.iml diff --git a/README.md b/README.md index 226fe49..4c0c9e2 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,12 @@ npm i -D @ns0m/witty-webpack-declaration-files ## Typescript - tsconfig.json ``` -{ ... - declaration: true, +{ ... + compilerOptions: { + ... + declaration: true + } } ``` diff --git a/example/package.json b/example/package.json index ee80ec1..75ed006 100644 --- a/example/package.json +++ b/example/package.json @@ -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" } } diff --git a/example/src/index.ts b/example/src/index.ts index 7ff32dc..4ce55dc 100644 --- a/example/src/index.ts +++ b/example/src/index.ts @@ -1,3 +1,5 @@ import render = require('./render'); -render(); \ No newline at end of file +render(); + +export let hi = 'Hello World!'; \ No newline at end of file diff --git a/example/tsconfig.json b/example/tsconfig.json index 13573ae..2f1d170 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "sourceMap": true + "sourceMap": true, + "declaration": true } } diff --git a/example/webpack.config.js b/example/webpack.config.js index 98148c3..de05cf9 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -1,5 +1,6 @@ 'use strict'; const path = require('path'); +const DeclarationFilesPlugin = require('@ns0m/witty-webpack-declaration-files'); module.exports = { devtool: 'inline-source-map', @@ -18,5 +19,10 @@ module.exports = { }, resolve: { extensions: [ '.ts', '.tsx', '.js' ] - } + }, + plugins: [ + new DeclarationFilesPlugin({ + merge: true + }) + ] };