Skip to content

Commit 4604c7d

Browse files
fix(template): add necessary types for typescript case
1 parent 501dd33 commit 4604c7d

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/create-webpack-app/templates/init/react/webpack.config.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import path from "node:path";
44
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
5+
import { type Configuration } from "webpack";<% if (devServer) { %>
6+
import "webpack-dev-server";<% } %><% } %><% if (htmlWebpackPlugin) { %>
57
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
68
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
79
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
@@ -14,7 +16,7 @@ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : "style-loader
1416
const stylesHandler = "style-loader";<% } %><% } %>
1517

1618
/** @type {import("webpack").Configuration} */
17-
const config = {
19+
const config <% if (langType === "Typescript") { %>: Configuration <% } %>= {
1820
entry: "<%= entry %>",
1921
output: {
2022
path: path.resolve(__dirname, "dist"),

packages/create-webpack-app/templates/init/svelte/webpack.config.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import path from "node:path";
44
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
5+
import { type Configuration } from "webpack";<% if (devServer) { %>
6+
import "webpack-dev-server";<% } %><% } %><% if (htmlWebpackPlugin) { %>
57
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
68
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
79
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
@@ -14,7 +16,7 @@ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : "style-loader
1416
const stylesHandler = "style-loader";<% } %><% } %>
1517

1618
/** @type {import("webpack").Configuration} */
17-
const config = {
19+
const config <% if (langType === "Typescript") { %>: Configuration <% } %>= {
1820
entry: "<%= entry %>",
1921
output: {
2022
path: path.resolve(__dirname, "dist"),

packages/create-webpack-app/templates/init/vue/webpack.config.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import { VueLoaderPlugin } from "vue-loader";
44
import path from "node:path";
55
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
6+
import { type Configuration } from "webpack";<% if (devServer) { %>
7+
import "webpack-dev-server";<% } %><% } %><% if (htmlWebpackPlugin) { %>
68
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
79
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
810
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
@@ -21,7 +23,7 @@ const stylesHandler = "vue-style-loader";
2123
<% } %>
2224

2325
/** @type {import("webpack").Configuration} */
24-
const config = {
26+
const config <% if (langType === "Typescript") { %>: Configuration <% } %>= {
2527
entry: "<%= entry %>",
2628
output: {
2729
path: path.resolve(__dirname, "dist"),

0 commit comments

Comments
 (0)