|
@@ -0,0 +1,81 @@
|
|
|
|
+const path = require("path");
|
|
|
|
+const webpack = require("webpack");
|
|
|
|
+
|
|
|
|
+module.exports = {
|
|
|
|
+ mode: "development",
|
|
|
|
+ devtool: false,
|
|
|
|
+ entry: {
|
|
|
|
+ "excalidraw.development": "./entry.js",
|
|
|
|
+ },
|
|
|
|
+ output: {
|
|
|
|
+ path: path.resolve(__dirname, "dist"),
|
|
|
|
+ library: "Excalidraw",
|
|
|
|
+ libraryTarget: "umd",
|
|
|
|
+ filename: "[name].js",
|
|
|
|
+ chunkFilename: "excalidraw-assets-dev/[name]-[contenthash].js",
|
|
|
|
+ publicPath: "",
|
|
|
|
+ },
|
|
|
|
+ resolve: {
|
|
|
|
+ extensions: [".js", ".ts", ".tsx", ".css", ".scss"],
|
|
|
|
+ },
|
|
|
|
+ module: {
|
|
|
|
+ rules: [
|
|
|
|
+ {
|
|
|
|
+ test: /\.(sa|sc|c)ss$/,
|
|
|
|
+ exclude: /node_modules/,
|
|
|
|
+ use: ["style-loader", { loader: "css-loader" }, "sass-loader"],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ test: /\.(ts|tsx|js|jsx|mjs)$/,
|
|
|
|
+ exclude: /node_modules/,
|
|
|
|
+ use: [
|
|
|
|
+ {
|
|
|
|
+ loader: "ts-loader",
|
|
|
|
+ options: {
|
|
|
|
+ transpileOnly: true,
|
|
|
|
+ configFile: path.resolve(__dirname, "../tsconfig.dev.json"),
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ test: /\.(woff|woff2|eot|ttf|otf)$/,
|
|
|
|
+ use: [
|
|
|
|
+ {
|
|
|
|
+ loader: "file-loader",
|
|
|
|
+ options: {
|
|
|
|
+ name: "[name].[ext]",
|
|
|
|
+ outputPath: "excalidraw-assets-dev",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ optimization: {
|
|
|
|
+ splitChunks: {
|
|
|
|
+ chunks: "async",
|
|
|
|
+ cacheGroups: {
|
|
|
|
+ vendors: {
|
|
|
|
+ test: /[\\/]node_modules[\\/]/,
|
|
|
|
+ name: "vendor",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ plugins: [new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ })],
|
|
|
|
+ externals: {
|
|
|
|
+ react: {
|
|
|
|
+ root: "React",
|
|
|
|
+ commonjs2: "react",
|
|
|
|
+ commonjs: "react",
|
|
|
|
+ amd: "react",
|
|
|
|
+ },
|
|
|
|
+ "react-dom": {
|
|
|
|
+ root: "ReactDOM",
|
|
|
|
+ commonjs2: "react-dom",
|
|
|
|
+ commonjs: "react-dom",
|
|
|
|
+ amd: "react-dom",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|