Skip to content

Instantly share code, notes, and snippets.

@mizchi
Last active March 15, 2020 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizchi/8541ddaf598a79d13096f9f0f869c335 to your computer and use it in GitHub Desktop.
Save mizchi/8541ddaf598a79d13096f9f0f869c335 to your computer and use it in GitHub Desktop.
const rewire = require("rewire");
const path = require("path");
const defaults = rewire("react-scripts/scripts/build.js");
const config = defaults.__get__("config");
config.optimization.runtimeChunk = false;
config.output.filename = "excalidraw.js";
config.output.libraryTarget = "umd";
config.output.library = "Excalidraw";
config.output.path = path.join(__dirname, "../dist");
config.entry = "./src/export";
config.externals = ["react", "react-dom"];
config.resolve.extensions = [".js", ".ts", ".tsx", ".scss", ".mjs"];
config.module.rules.push(
{
test: /\.css/,
use: [
"style-loader",
{
loader: "css-loader",
options: { url: false },
},
],
},
{
test: /\.scss/,
use: [
"style-loader",
{
loader: "sass-loader",
options: { url: false },
},
],
},
);
config.plugins = [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment