From 8c2bc9433603041ca7a1055420905310857652ca Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Tue, 19 Jan 2021 19:59:05 +0530 Subject: [PATCH] build(webpack): bundle css files with js (#2819) --- src/packages/excalidraw/entry.js | 6 ++++++ src/packages/excalidraw/webpack.prod.config.js | 11 ++--------- 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 src/packages/excalidraw/entry.js diff --git a/src/packages/excalidraw/entry.js b/src/packages/excalidraw/entry.js new file mode 100644 index 000000000..8a0d08d9b --- /dev/null +++ b/src/packages/excalidraw/entry.js @@ -0,0 +1,6 @@ +import Excalidraw from "./index"; + +import "../../../public/fonts.css"; + +export default Excalidraw; +export * from "./index"; diff --git a/src/packages/excalidraw/webpack.prod.config.js b/src/packages/excalidraw/webpack.prod.config.js index bb04502d0..434c20599 100644 --- a/src/packages/excalidraw/webpack.prod.config.js +++ b/src/packages/excalidraw/webpack.prod.config.js @@ -1,5 +1,4 @@ const path = require("path"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const TerserPlugin = require("terser-webpack-plugin"); const BundleAnalyzerPlugin = require("webpack-bundle-analyzer") .BundleAnalyzerPlugin; @@ -7,8 +6,7 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer") module.exports = { mode: "production", entry: { - "excalidraw.min": "./index.tsx", - "fonts.min": "../../../public/fonts.css", + "excalidraw.min": "./entry.js", }, output: { path: path.resolve(__dirname, "dist"), @@ -26,11 +24,7 @@ module.exports = { { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, - use: [ - MiniCssExtractPlugin.loader, - { loader: "css-loader" }, - "sass-loader", - ], + use: ["style-loader", { loader: "css-loader" }, "sass-loader"], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, @@ -94,7 +88,6 @@ module.exports = { }, }, plugins: [ - new MiniCssExtractPlugin({ filename: "[name].css" }), ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), ], externals: {