Skip to content

Commit

Permalink
Restore normal webpack bundling
Browse files Browse the repository at this point in the history
Fixes a regression from #218.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Jan 2, 2023
1 parent abc2646 commit 075a9ee
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 6 deletions.
60 changes: 60 additions & 0 deletions @injection-webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const path = require('path');

module.exports = {
entry: './@injection.js',
mode: 'production',
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
externals: [
{
'@runtime': {
root: '@runtime',
commonjs: '@runtime',
commonjs2: '@runtime',
amd: '@runtime'
},
'@runtime/cache': {
root: '@runtime/cache',
commonjs: '@runtime/cache',
commonjs2: '@runtime/cache',
amd: '@runtime/cache'
},
'@runtime/Defaults': {
root: '@runtime/Defaults',
commonjs: '@runtime/Defaults',
commonjs2: '@runtime/Defaults',
amd: '@runtime/Defaults'
},
'@runtime/provider': {
root: '@runtime/provider',
commonjs: '@runtime/provider',
commonjs2: '@runtime/provider',
amd: '@runtime/provider'
},
'@runtime/RuleSupport': {
root: '@runtime/RuleSupport',
commonjs: '@runtime/RuleSupport',
commonjs2: '@runtime/RuleSupport',
amd: '@runtime/RuleSupport'
},
'@runtime/osgi': {
root: '@runtime/osgi',
commonjs: '@runtime/osgi',
commonjs2: '@runtime/osgi',
amd: '@runtime/osgi'
}
}
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '@openhab-injection.js',
library: {
name: '@openhab-injection',
type: 'umd'
},
globalObject: 'this'
}
};
File renamed without changes.
4 changes: 2 additions & 2 deletions DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Webpack

openhab-js and it's injection script can be compiled into a single JS file, which is how we ship the library with the JS Scripting automation addon in openHAB.
Both openhab-js and it's injection script can be compiled into a single JS file, which is very convenient for deploying locally and which is how we ship the library with the JS Scripting automation addon in openHAB.

```bash
npm run webpack
```

This outputs the library, and it's injection script as a single JS file to `dist/@openhab-globals.js`.
This outputs the library as a single JS file to `dist/openhab.js`, and it's injection script as a single JS file to `dist/@openhab-injection.js`.

## TypeScript type definitions

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"deploy": "npm test && npm run docs && npm run webpack",
"lint": "npx standardx | snazzy",
"lint:fix": "npx standardx --fix",
"webpack": "webpack",
"webpack": "webpack && webpack -c @injection-webpack.config.js",
"types": "tsc",
"types:test": "tsc --project tsconfig.test.json"
},
Expand Down
6 changes: 3 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');

module.exports = {
entry: './@openhab-globals.js',
entry: './index.js',
mode: 'production',
performance: {
hints: false,
Expand Down Expand Up @@ -50,9 +50,9 @@ module.exports = {
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '@openhab-globals.js',
filename: 'openhab.js',
library: {
name: '@openhab-globals',
name: 'openhab',
type: 'umd'
},
globalObject: 'this'
Expand Down

0 comments on commit 075a9ee

Please sign in to comment.