|
| 1 | +const path = require("path"); |
| 2 | +const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); |
| 3 | +const HtmlWebpackPlugin = require("html-webpack-plugin"); |
| 4 | + |
| 5 | +const resolve = query => path.resolve(__dirname, query); |
| 6 | + |
| 7 | +module.exports = { |
| 8 | + devtool: "source-map", |
| 9 | + entry: { |
| 10 | + landing_bundle: resolve("src/landing/index.ts"), |
| 11 | + play_bundle: resolve("src/playground/index.ts"), |
| 12 | + }, |
| 13 | + output: { path: resolve("dist") }, |
| 14 | + resolve: { extensions: [".tsx", ".ts", ".js"] }, |
| 15 | + node: { fs: "empty" }, |
| 16 | + module: { |
| 17 | + rules: [ |
| 18 | + { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/ }, |
| 19 | + { test: /\.css$/, use: ["style-loader", "css-loader"] }, |
| 20 | + { |
| 21 | + test: /\.(png|svg|jpg|gif|ico)$/, |
| 22 | + loader: "url-loader", |
| 23 | + options: { esModule: false, name: "[path][name].[ext]?hash=[hash:20]", limit: 8192 }, |
| 24 | + }, |
| 25 | + { test: /\.ttf$/, loader: "file-loader" }, |
| 26 | + { test: /\.scss$/, use: ["style-loader", "css-loader", "sass-loader"] }, |
| 27 | + { test: /\.webmanifest?$/, loader: "file-loader", options: { esModule: false } }, |
| 28 | + ], |
| 29 | + }, |
| 30 | + plugins: [ |
| 31 | + new HtmlWebpackPlugin({ |
| 32 | + title: "TypeScriptToLua", |
| 33 | + chunks: ["landing_bundle"], |
| 34 | + template: resolve("assets/layout/template.html"), |
| 35 | + filename: "index.html", |
| 36 | + contentFile: "landing.html", |
| 37 | + }), |
| 38 | + |
| 39 | + new MonacoWebpackPlugin({ languages: ["javascript", "typescript", "lua"] }), |
| 40 | + new HtmlWebpackPlugin({ |
| 41 | + title: "TypeScriptToLua - Online Compiler", |
| 42 | + chunks: ["play_bundle"], |
| 43 | + template: resolve("assets/layout/template.html"), |
| 44 | + filename: "play.html", |
| 45 | + contentFile: "play.html", |
| 46 | + }), |
| 47 | + ], |
| 48 | +}; |
0 commit comments