Skip to content

Commit 8b863e0

Browse files
refactor(templates): Standardize all templates to use double quotes (") for consistency
1 parent 3917e27 commit 8b863e0

6 files changed

Lines changed: 269 additions & 269 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import autoprefixer from 'autoprefixer';
1+
import autoprefixer from "autoprefixer";
22

33
export default {
44
// Add you postcss configuration here
55
// Learn more about it at https://github.com/webpack-contrib/postcss-loader#config-files
6-
plugins: [['autoprefixer']],
6+
plugins: [["autoprefixer"]],
77
};

packages/create-webpack-app/templates/init/default/webpack.config.js.tpl

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
import path from "node:path";
44
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
5-
import HtmlWebpackPlugin from 'html-webpack-plugin';<% } %><% if (extractPlugin !== 'No') { %>
6-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';<% } %><% if (workboxWebpackPlugin) { %>
7-
import WorkboxWebpackPlugin from 'workbox-webpack-plugin';<% } %>
5+
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
6+
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
7+
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
88

99
const __filename = fileURLToPath(import.meta.url);
1010
const __dirname = path.dirname(__filename);
11-
const isProduction = process.env.NODE_ENV === 'production';
12-
<% if (cssType !== 'none') { %>
11+
const isProduction = process.env.NODE_ENV === "production";
12+
<% if (cssType !== "none") { %>
1313
<% if (extractPlugin === "Yes") { %>
1414
const stylesHandler = MiniCssExtractPlugin.loader;
1515
<% } else if (extractPlugin === "Only for Production") { %>
16-
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
16+
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : "style-loader";
1717
<% } else { %>
18-
const stylesHandler = 'style-loader';
18+
const stylesHandler = "style-loader";
1919
<% } %>
2020
<% } %>
2121

2222
/** @type {import("webpack").Configuration} */
2323
const config = {
24-
entry: '<%= entryPoint %>',
24+
entry: "<%= entryPoint %>",
2525
output: {
26-
path: path.resolve(__dirname, 'dist'),
26+
path: path.resolve(__dirname, "dist"),
2727
},<% if (devServer) { %>
2828
devServer: {
2929
open: true,
30-
host: 'localhost',
30+
host: "localhost",
3131
},<% } %>
3232
plugins: [<% if (htmlWebpackPlugin) { %>
3333
new HtmlWebpackPlugin({
34-
template: 'index.html',
34+
template: "index.html",
3535
}),
3636
<% } %><% if (extractPlugin === "Yes") { %>
3737
new MiniCssExtractPlugin(),
@@ -43,63 +43,63 @@ const config = {
4343
rules: [<% if (langType == "ES6") { %>
4444
{
4545
test: /\.(js|jsx)$/i,
46-
loader: 'babel-loader',
46+
loader: "babel-loader",
4747
},<% } %><% if (langType == "Typescript") { %>
4848
{
4949
test: /\.(ts|tsx)$/i,
50-
loader: 'ts-loader',
51-
exclude: ['/node_modules/'],
50+
loader: "ts-loader",
51+
exclude: ["/node_modules/"],
5252
},<% } %><% if (isCSS && !isPostCSS) { %>
5353
{
5454
test: /\.css$/i,
55-
use: [stylesHandler,'css-loader'],
56-
},<% } %><% if (cssType == 'SASS') { %>
55+
use: [stylesHandler,"css-loader"],
56+
},<% } %><% if (cssType == "SASS") { %>
5757
{
5858
test: /\.s[ac]ss$/i,
59-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'sass-loader'],
60-
},<% } %><% if (cssType == 'LESS') { %>
59+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"sass-loader"],
60+
},<% } %><% if (cssType == "LESS") { %>
6161
{
6262
test: /\.less$/i,
63-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'less-loader'],
64-
},<% } %><% if (cssType == 'Stylus') { %>
63+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"less-loader"],
64+
},<% } %><% if (cssType == "Stylus") { %>
6565
{
6666
test: /\.styl$/i,
67-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'stylus-loader'],
67+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"stylus-loader"],
6868
},<% } %><% if (isPostCSS && isCSS) { %>
6969
{
7070
test: /\.css$/i,
71-
use: [stylesHandler, 'css-loader', 'postcss-loader'],
71+
use: [stylesHandler, "css-loader", "postcss-loader"],
7272
},<% } %>
7373
{
7474
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
75-
type: 'asset',
75+
type: "asset",
7676
},
7777
%><% if (htmlWebpackPlugin) { %>
7878
{
7979
test: /\.html$/i,
80-
use: ['html-loader'],
80+
use: ["html-loader"],
8181
},<% } %>
8282

8383
// Add your rules for custom modules here
8484
// Learn more about loaders from https://webpack.js.org/loaders/
8585
],
8686
},<% if (langType == "Typescript") {%>
8787
resolve: {
88-
extensions: ['.tsx', '.ts', '.jsx', '.js', '...'],
88+
extensions: [".tsx", ".ts", ".jsx", ".js", "..."],
8989
},<% } %>
9090
};
9191

9292
export default () => {
9393
if (isProduction) {
94-
config.mode = 'production';
94+
config.mode = "production";
9595
<% if (extractPlugin === "Only for Production") { %>
9696
config.plugins.push(new MiniCssExtractPlugin());
9797
<% } %>
9898
<% if (workboxWebpackPlugin) { %>
9999
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
100100
<% } %>
101101
} else {
102-
config.mode = 'development';
102+
config.mode = "development";
103103
}
104104
return config;
105105
};

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
import path from "node:path";
44
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
5-
import HtmlWebpackPlugin from 'html-webpack-plugin';<% } %><% if (extractPlugin !== 'No') { %>
6-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';<% } %><% if (workboxWebpackPlugin) { %>
7-
import WorkboxWebpackPlugin from 'workbox-webpack-plugin';<% } %>
5+
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
6+
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
7+
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
88

99
const __filename = fileURLToPath(import.meta.url);
1010
const __dirname = path.dirname(__filename);
11-
const isProduction = process.env.NODE_ENV === 'production';
12-
<% if (cssType !== 'none') { %>
11+
const isProduction = process.env.NODE_ENV === "production";
12+
<% if (cssType !== "none") { %>
1313
<% if (extractPlugin === "Yes") { %>
1414
const stylesHandler = MiniCssExtractPlugin.loader;
1515
<% } else if (extractPlugin === "Only for Production") { %>
16-
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
16+
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : "style-loader";
1717
<% } else { %>
18-
const stylesHandler = 'style-loader';
18+
const stylesHandler = "style-loader";
1919
<% } %>
2020
<% } %>
2121

2222
/** @type {import("webpack").Configuration} */
2323
const config = {
24-
entry: '<%= entry %>',
24+
entry: "<%= entry %>",
2525
output: {
26-
path: path.resolve(__dirname, 'dist'),
26+
path: path.resolve(__dirname, "dist"),
2727
},<% if (devServer) { %>
2828
devServer: {
2929
open: true,
30-
host: 'localhost',
30+
host: "localhost",
3131
},<% } %>
3232
plugins: [<% if (htmlWebpackPlugin) { %>
3333
new HtmlWebpackPlugin({
34-
template: 'index.html',
34+
template: "index.html",
3535
}),
3636
<% } %><% if (extractPlugin === "Yes") { %>
3737
new MiniCssExtractPlugin(),
@@ -53,32 +53,32 @@ const config = {
5353
},<% } %><% if (langType == "Typescript") { %>
5454
{
5555
test: /\.(ts|tsx)$/i,
56-
loader: 'ts-loader',
57-
exclude: ['/node_modules/'],
56+
loader: "ts-loader",
57+
exclude: ["/node_modules/"],
5858
},<% } %><% if (isCSS && !isPostCSS) { %>
5959
{
6060
test: /\.css$/i,
61-
use: [stylesHandler,'css-loader'],
62-
},<% } %><% if (cssType == 'SASS') { %>
61+
use: [stylesHandler,"css-loader"],
62+
},<% } %><% if (cssType == "SASS") { %>
6363
{
6464
test: /\.s[ac]ss$/i,
65-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'sass-loader'],
66-
},<% } %><% if (cssType == 'LESS') { %>
65+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"sass-loader"],
66+
},<% } %><% if (cssType == "LESS") { %>
6767
{
6868
test: /\.less$/i,
69-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'less-loader'],
70-
},<% } %><% if (cssType == 'Stylus') { %>
69+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"less-loader"],
70+
},<% } %><% if (cssType == "Stylus") { %>
7171
{
7272
test: /\.styl$/i,
73-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'stylus-loader'],
73+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"stylus-loader"],
7474
},<% } %><% if (isPostCSS && isCSS) { %>
7575
{
7676
test: /\.css$/i,
77-
use: [stylesHandler, 'css-loader', 'postcss-loader'],
77+
use: [stylesHandler, "css-loader", "postcss-loader"],
7878
},<% } %>
7979
{
8080
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
81-
type: 'asset',
81+
type: "asset",
8282
},
8383

8484
// Add your rules for custom modules here
@@ -89,21 +89,21 @@ const config = {
8989
alias: {
9090
"@": path.resolve(__dirname, "./src/"),
9191
},
92-
extensions: ['.jsx', '.js'<% if (langType === 'Typescript') { %>, '.tsx', '.ts'<% } %>],
92+
extensions: [".jsx", ".js"<% if (langType === "Typescript") { %>, ".tsx", ".ts"<% } %>],
9393
},
9494
};
9595

9696
export default () => {
9797
if (isProduction) {
98-
config.mode = 'production';
98+
config.mode = "production";
9999
<% if (extractPlugin === "Only for Production") { %>
100100
config.plugins.push(new MiniCssExtractPlugin());
101101
<% } %>
102102
<% if (workboxWebpackPlugin) { %>
103103
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
104104
<% } %>
105105
} else {
106-
config.mode = 'development';
106+
config.mode = "development";
107107
}
108108
return config;
109109
};

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
import path from "node:path";
44
import { fileURLToPath } from "node:url";<% if (htmlWebpackPlugin) { %>
5-
import HtmlWebpackPlugin from 'html-webpack-plugin';<% } %><% if (extractPlugin !== 'No') { %>
6-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';<% } %><% if (workboxWebpackPlugin) { %>
7-
import WorkboxWebpackPlugin from 'workbox-webpack-plugin';<% } %>
5+
import HtmlWebpackPlugin from "html-webpack-plugin";<% } %><% if (extractPlugin !== "No") { %>
6+
import MiniCssExtractPlugin from "mini-css-extract-plugin";<% } %><% if (workboxWebpackPlugin) { %>
7+
import WorkboxWebpackPlugin from "workbox-webpack-plugin";<% } %>
88

99
const __filename = fileURLToPath(import.meta.url);
1010
const __dirname = path.dirname(__filename);
11-
const isProduction = process.env.NODE_ENV === 'production';
12-
<% if (cssType !== 'none') { %>
11+
const isProduction = process.env.NODE_ENV === "production";
12+
<% if (cssType !== "none") { %>
1313
<% if (extractPlugin === "Yes") { %>
1414
const stylesHandler = MiniCssExtractPlugin.loader;
1515
<% } else if (extractPlugin === "Only for Production") { %>
16-
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
16+
const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : "style-loader";
1717
<% } else { %>
18-
const stylesHandler = 'style-loader';
18+
const stylesHandler = "style-loader";
1919
<% } %>
2020
<% } %>
2121

2222
/** @type {import("webpack").Configuration} */
2323
const config = {
24-
entry: '<%= entry %>',
24+
entry: "<%= entry %>",
2525
output: {
26-
path: path.resolve(__dirname, 'dist'),
26+
path: path.resolve(__dirname, "dist"),
2727
},<% if (devServer) { %>
2828
devServer: {
2929
open: true,
30-
host: 'localhost',
30+
host: "localhost",
3131
},<% } %>
3232
plugins: [<% if (htmlWebpackPlugin) { %>
3333
new HtmlWebpackPlugin({
34-
template: './index.html',
34+
template: "./index.html",
3535
}),
3636
<% } %><% if (extractPlugin === "Yes") { %>
3737
new MiniCssExtractPlugin(),
@@ -44,7 +44,7 @@ const config = {
4444
{
4545
test: /\.svelte$/,
4646
use: {
47-
loader: 'svelte-loader',
47+
loader: "svelte-loader",
4848
options: {
4949
emitCss: true,
5050
hotReload: true
@@ -63,35 +63,35 @@ const config = {
6363
},<% } %><% if (langType == "Typescript") { %>
6464
{
6565
test: /\.ts$/,
66-
loader: 'ts-loader',
66+
loader: "ts-loader",
6767
exclude: /node_modules/,
6868
options: {
6969
appendTsSuffixTo: [/\.svelte$/],
7070
},
7171
},<% } %><% if (isCSS && !isPostCSS) { %>
7272
{
7373
test: /\.css$/i,
74-
use: [stylesHandler,'css-loader'],
75-
},<% } %><% if (cssType == 'SASS') { %>
74+
use: [stylesHandler,"css-loader"],
75+
},<% } %><% if (cssType == "SASS") { %>
7676
{
7777
test: /\.s[ac]ss$/i,
78-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'sass-loader'],
79-
},<% } %><% if (cssType == 'LESS') { %>
78+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"sass-loader"],
79+
},<% } %><% if (cssType == "LESS") { %>
8080
{
8181
test: /\.less$/i,
82-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'less-loader'],
83-
},<% } %><% if (cssType == 'Stylus') { %>
82+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"less-loader"],
83+
},<% } %><% if (cssType == "Stylus") { %>
8484
{
8585
test: /\.styl$/i,
86-
use: [stylesHandler, 'css-loader', <% if (isPostCSS) { %>'postcss-loader', <% } %>'stylus-loader'],
86+
use: [stylesHandler, "css-loader", <% if (isPostCSS) { %>"postcss-loader", <% } %>"stylus-loader"],
8787
},<% } %><% if (isPostCSS && isCSS) { %>
8888
{
8989
test: /\.css$/i,
90-
use: [stylesHandler, 'css-loader', 'postcss-loader'],
90+
use: [stylesHandler, "css-loader", "postcss-loader"],
9191
},<% } %>
9292
{
9393
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
94-
type: 'asset',
94+
type: "asset",
9595
},
9696
// Add your rules for custom modules here
9797
// Learn more about loaders from https://webpack.js.org/loaders/
@@ -101,23 +101,23 @@ const config = {
101101
alias: {
102102
"@": path.resolve(__dirname, "./src/"),
103103
},
104-
extensions: ['.mjs', '.js', '.svelte'<% if (langType == "Typescript") {%>, '.ts'<% } %>],
105-
mainFields: ['svelte', 'browser', 'module', 'main'],
106-
conditionNames: ['svelte', 'module', 'browser', 'main', 'default']
104+
extensions: [".mjs", ".js", ".svelte"<% if (langType == "Typescript") {%>, ".ts"<% } %>],
105+
mainFields: ["svelte", "browser", "module", "main"],
106+
conditionNames: ["svelte", "module", "browser", "main", "default"]
107107
},
108108
};
109109

110110
export default () => {
111111
if (isProduction) {
112-
config.mode = 'production';
112+
config.mode = "production";
113113
<% if (extractPlugin === "Only for Production") { %>
114114
config.plugins.push(new MiniCssExtractPlugin());
115115
<% } %>
116116
<% if (workboxWebpackPlugin) { %>
117117
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
118118
<% } %>
119119
} else {
120-
config.mode = 'development';
120+
config.mode = "development";
121121
}
122122
return config;
123123
};

0 commit comments

Comments
 (0)