style-loader だけを使う
npm i
npx webpack-dev-server
# or
npx webpack
it works...
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = {
mode: process.env.NODE_ENV,
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "./dist"),
filename: "build.js",
},
module: {
rules: [
{
test: /\.(tsx|ts|js)$/,
use: [
{
loader: "ts-loader",
},
],
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ["style-loader", "raw-loader"],
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
},
plugins: [new HtmlWebpackPlugin({ template: "./src/index.html" })],
};