Skip to content

Commit 8de5a96

Browse files
ofekdOfek
ofekd
and
Ofek
authored
generate typings (#62)
Co-authored-by: Ofek <[email protected]>
1 parent 87746ad commit 8de5a96

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
"*.json",
5959
"*.js"
6060
],
61+
"typings": "./dist/main.d.ts",
6162
"main": "./dist/vue-tailwind.umd.js"
6263
}

vue.config.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* These are some necessary steps changing the default webpack config of the Vue CLI
3+
* that need to be changed in order for TypeScript based components to generate their
4+
* declaration (.d.ts) files.
5+
* Code by various users from https://github.com/vuejs/vue-cli/issues/1081
6+
*/
7+
const fixEmitDeclarationFilesForTypeScript = {
8+
chainWebpack: config => {
9+
if (process.env.NODE_ENV === "production") {
10+
config.module.rule("ts").uses.delete("cache-loader");
11+
config.module
12+
.rule("ts")
13+
.use("ts-loader")
14+
.loader("ts-loader")
15+
.tap(options => ({
16+
...options,
17+
transpileOnly: false,
18+
happyPackMode: false
19+
}));
20+
}
21+
},
22+
parallel: false
23+
};
24+
25+
module.exports = {
26+
...fixEmitDeclarationFilesForTypeScript
27+
};

0 commit comments

Comments
 (0)