commit c3a301a1385be6fbe325f146b3bc42c2cbcacacf Author: Daniel Bulant Date: Sun Apr 4 12:27:24 2021 +0200 minimum example diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f52e6f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +pnpm-lock.yaml \ No newline at end of file diff --git a/.nolluprc.js b/.nolluprc.js new file mode 100644 index 0000000..3c04066 --- /dev/null +++ b/.nolluprc.js @@ -0,0 +1,5 @@ +module.exports = { + contentBase: 'public', + port: 9001, + hot: true +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..ae22078 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "scripts": { + "clean": "shx rm -rf dist", + "start": "nollup -c --environment NODE_ENV:development", + "build": "npm run clean && rollup -c --environment NODE_ENV:production" + }, + "devDependencies": { + "nollup": "^0.15.0", + "rollup": "^2.38.5", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-static-files": "0.0.1", + "rollup-plugin-terser": "^5.1.1", + "shx": "^0.3.2" + } +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..a97fbfd --- /dev/null +++ b/public/index.html @@ -0,0 +1,16 @@ + + + + + + Barebones + + +
+ + + \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..c26fc03 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,27 @@ +import node_resolve from 'rollup-plugin-node-resolve'; +import static_files from 'rollup-plugin-static-files'; +import { terser } from 'rollup-plugin-terser'; + +let config = { + input: './src/sharedworker.js', + output: { + dir: 'dist', + format: 'esm', + entryFileNames: '[name].js', + assetFileNames: '[name][extname]' + }, + plugins: [ + node_resolve() + ] +} + +if (process.env.NODE_ENV === 'production') { + config.plugins = config.plugins.concat([ + static_files({ + include: ['./public'] + }), + terser() + ]); +} + +export default config; diff --git a/src/sharedworker.js b/src/sharedworker.js new file mode 100644 index 0000000..c514e8e --- /dev/null +++ b/src/sharedworker.js @@ -0,0 +1,5 @@ + +self.port.start(); +self.port.addEventListener("message", (...args) => { + console.log("message", ...args); +}); \ No newline at end of file