Skip to content

Commit

Permalink
Reduce rebuild time during development
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelpicosean committed Mar 25, 2021
1 parent 70df53a commit 3e1a5dc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin");

module.exports = {
entry: path.resolve(__dirname, "./src/game/main.ts"),
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
options: {
transpileOnly: true,
experimentalWatchApi: true,
},
},
// Shaders
{
Expand Down Expand Up @@ -39,6 +42,7 @@ module.exports = {
output: {
filename: "[name].js",
path: path.resolve(__dirname, "dist"),
pathinfo: false,
},
plugins: [
new CleanWebpackPlugin,
Expand Down
19 changes: 19 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
const path = require("path");

const { merge } = require("webpack-merge");
const common = require("./webpack.common.js");

module.exports = merge(common, {
entry: {
engine: {
import: path.resolve(__dirname, "./src/engine/index.ts"),
},
main: {
import: path.resolve(__dirname, "./src/game/main.ts"),
dependOn: "engine",
},
},
optimization: {
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,

runtimeChunk: true,
},

devtool: "inline-source-map",
mode: "development",
devServer: {
Expand Down
2 changes: 2 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const TerserPlugin = require("terser-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");

module.exports = merge(common, {
entry: path.resolve(__dirname, "./src/game/main.ts"),

plugins: [
new CopyPlugin({
patterns: [
Expand Down

0 comments on commit 3e1a5dc

Please sign in to comment.