Skip to content

Commit

Permalink
Update webpack to build prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurt Hutten committed Jan 22, 2021
1 parent ef2a708 commit a7a005b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 37 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#1e1e1e">

<link rel='shortcut icon' href='./icon/favicon.ico' type='image/x-icon' >
<link rel="manifest" href="./manifest.webmanifest">
<link rel="apple-touch-icon" href="./icon/apple-touch-icon.png">
<link rel='shortcut icon' href='icon/favicon.ico' type='image/x-icon' >
<link rel="manifest" href="manifest.webmanifest">
<link rel="apple-touch-icon" href="icon/apple-touch-icon.png">

</head>

Expand Down
2 changes: 1 addition & 1 deletion js/MainPage/CascadeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function CascadeEnvironment (goldenContainer) {

// Load the Shiny Dull Metal Matcap Material
this.loader = new THREE.TextureLoader(); this.loader.setCrossOrigin ('');
this.matcap = this.loader.load ('./textures/dullFrontLitMetal.png', (tex) => this.environment.viewDirty = true );
this.matcap = this.loader.load ('textures/dullFrontLitMetal.png', (tex) => this.environment.viewDirty = true );
this.matcapMaterial = new THREE.MeshMatcapMaterial({
color: new THREE.Color(0xf5f5f5),
matcap: this.matcap,
Expand Down
4 changes: 2 additions & 2 deletions js/MainPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { initialize } from "./CascadeMain";

if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("service-worker.js").then(
function(registration) {
(registration) => {
registration.update(); // Always update the registration for the latest assets
},
function() {
() => {
console.log("Could not register Cascade Studio for offline use!");
}
);
Expand Down
68 changes: 38 additions & 30 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ const CopyPlugin = require("copy-webpack-plugin");
const config = {
entry: {
main: ["babel-polyfill", "./js/MainPage/index.js"],
workerLibrary: "./js/CADWorker/CascadeStudioStandardLibrary.js"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].bundle.js"
filename: "[name].bundle.js",
},
watch: true,
module: {
rules: [
{
test: /\.js$/,
use: "babel-loader",
exclude: /node_modules/
exclude: /node_modules/,
},
{
test: /\.css$/,
Expand All @@ -28,11 +26,11 @@ const config = {
{
loader: "css-loader",
options: {
importLoaders: 1
}
importLoaders: 1,
},
},
"postcss-loader"
]
"postcss-loader",
],
},
{
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
Expand All @@ -41,44 +39,54 @@ const config = {
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "fonts/"
}
}
]
outputPath: "fonts/",
},
},
],
},
{
test: /opencascade\.wasm\.wasm$/,
type: "javascript/auto",
loader: "file-loader"
}
]
loader: "file-loader",
},
],
},
node: {
fs: "empty"
fs: "empty",
},
plugins: [
new HtmlWebpackPlugin({
appMountId: "app",
filename: "index.html",
template: "index.html"
template: path.resolve(__dirname, "index.html"),
}),
new MonacoWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: "js/StandardLibraryIntellisense.ts",
to: "js/StandardLibraryIntellisense.ts"
to: "js/StandardLibraryIntellisense.ts",
},
{
from: "static_node_modules/opencascade.js/dist/oc.d.ts",
to: "opencascade.d.ts"
to: "opencascade.d.ts",
},
{
from: "node_modules/three/src/Three.d.ts",
to: "Three.d.ts"
}
]
})
to: "Three.d.ts",
},
{
from: "fonts",
to: "fonts",
},
{
from: "icon",
to: "icon",
},
{
from: "textures",
to: "textures",
},
],
}),
],
optimization: {
runtimeChunk: "single",
Expand All @@ -87,11 +95,11 @@ const config = {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all"
}
}
}
}
chunks: "all",
},
},
},
},
};

module.exports = config;
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,12 @@ camelcase@^6.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==

caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001173:
caniuse-lite@^1.0.30001109:
version "1.0.30001179"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001179.tgz#b0803883b4471a6c62066fb1752756f8afc699c8"
integrity sha512-blMmO0QQujuUWZKyVrD1msR4WNDAqb/UPO1Sw2WWsQ7deoM5bJiicKnWJ1Y0NS/aGINSnKPIWBMw5luX+NDUCA==

caniuse-lite@^1.0.30001173:
version "1.0.30001177"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001177.tgz#2c3b384933aafda03e29ccca7bb3d8c3389e1ece"
integrity sha512-6Ld7t3ifCL02jTj3MxPMM5wAYjbo4h/TAQGFTgv1inihP1tWnWp8mxxT4ut4JBEHLbpFXEXJJQ119JCJTBkYDw==
Expand Down

0 comments on commit a7a005b

Please sign in to comment.