build(webpack): bundle css files with js (#2819)
This commit is contained in:
parent
fb4d97ef78
commit
8c2bc94336
6
src/packages/excalidraw/entry.js
Normal file
6
src/packages/excalidraw/entry.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import Excalidraw from "./index";
|
||||||
|
|
||||||
|
import "../../../public/fonts.css";
|
||||||
|
|
||||||
|
export default Excalidraw;
|
||||||
|
export * from "./index";
|
@ -1,5 +1,4 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
||||||
.BundleAnalyzerPlugin;
|
.BundleAnalyzerPlugin;
|
||||||
@ -7,8 +6,7 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
entry: {
|
entry: {
|
||||||
"excalidraw.min": "./index.tsx",
|
"excalidraw.min": "./entry.js",
|
||||||
"fonts.min": "../../../public/fonts.css",
|
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, "dist"),
|
||||||
@ -26,11 +24,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
test: /\.(sa|sc|c)ss$/,
|
test: /\.(sa|sc|c)ss$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: [
|
use: ["style-loader", { loader: "css-loader" }, "sass-loader"],
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{ loader: "css-loader" },
|
|
||||||
"sass-loader",
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(ts|tsx|js|jsx|mjs)$/,
|
test: /\.(ts|tsx|js|jsx|mjs)$/,
|
||||||
@ -94,7 +88,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new MiniCssExtractPlugin({ filename: "[name].css" }),
|
|
||||||
...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []),
|
...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []),
|
||||||
],
|
],
|
||||||
externals: {
|
externals: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user