Use production/development flags correctly

This commit is contained in:
Maximilian Ammann 2021-12-10 10:12:10 +01:00
parent 8f49a0e59d
commit 5a1030b150
7 changed files with 11 additions and 9 deletions

View File

@ -35,7 +35,7 @@ jobs:
- name: NPM Install
run: npm install
- name: Build
run: npm run build
run: npm run production-build
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
@ -43,7 +43,7 @@ jobs:
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org "rm -f ~/public_html/mapr/*"
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "dist/." max@maxammann.org:~/public_html/mapr/
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "dist/demo/." max@maxammann.org:~/public_html/mapr/
book:
runs-on: ubuntu-latest

View File

View File

@ -0,0 +1 @@
# Chapter 1

View File

@ -1,4 +1,4 @@
import init from "mapr";
import init from "./dist/libs/mapr";
onmessage = async m => {
let msg = m.data;

View File

@ -1,4 +1,4 @@
import init from "mapr";
import init from "./dist/libs/mapr";
const start = async () => {
const memory = new WebAssembly.Memory({initial: 1024, maximum: 10 * 1024, shared: true});

View File

@ -4,8 +4,9 @@
"description": "A mapr demo",
"main": "index.js",
"scripts": {
"start": "RUSTUP_TOOLCHAIN=nightly-2021-12-07-x86_64-unknown-linux-gnu webpack-dev-server",
"build": "RUSTUP_TOOLCHAIN=nightly-2021-12-07-x86_64-unknown-linux-gnu webpack"
"start": "RUSTUP_TOOLCHAIN=nightly-2021-12-07-x86_64-unknown-linux-gnu webpack-dev-server --mode=development",
"build": "RUSTUP_TOOLCHAIN=nightly-2021-12-07-x86_64-unknown-linux-gnu webpack --mode=development",
"production-build": "RUSTUP_TOOLCHAIN=nightly-2021-12-07-x86_64-unknown-linux-gnu webpack --mode=production"
},
"repository": {
"type": "git",

View File

@ -2,7 +2,7 @@ const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
let dist = path.join(__dirname, 'dist');
let dist = path.join(__dirname, 'dist/demo');
module.exports = {
mode: "development",
entry: {
@ -56,7 +56,7 @@ module.exports = {
// ],
// The same as the `--out-dir` option for `wasm-pack`
outDir: path.resolve(__dirname, './libs/mapr'),
outDir: path.resolve(__dirname, 'dist/libs/mapr'),
// The same as the `--out-name` option for `wasm-pack`
// outName: "index",
@ -74,7 +74,7 @@ module.exports = {
//
// the mode `development` makes `wasm-pack` build in `debug` mode.
// the mode `production` makes `wasm-pack` build in `release` mode.
forceMode: "production",
// forceMode: "production",
// Controls plugin output verbosity, either 'info' or 'error'.
// Defaults to 'info'.