harfel
February 6, 2022, 9:39pm
1
I just asked this over at Stackoverflow (javascript - Uncaught (in promise) ReferenceError: process is not defined when calling createRxDatabase in aurelia app - Stack Overflow ) but hopefully have better chances to receive an answer here…
I am trying to use rxdb as a store for my aurelia app. I have not found a plugin that implements this aleady, so start writing my own solution. I am using aurelia-cli 2.0.3, aurelia-loader-nodejs 1.1.0 and aurelia-webpack-plugin 5.0.3 with rxdb 11.3.0.
The problem I am running into is that as soon as I call createRxDatabase I get the error “Uncaught (in promise) ReferenceError: process is not defined” in the browser console. I tried to follow the recipe given in javascript - Uncaught ReferenceError: process is not defined - Stack Overflow but this result in the following webpack-dev-server warning: “DefinePlugin: Conflicting values for ‘process.env.NODE_ENV’”
Any clues how I can please rxdb?
hiaux0
February 18, 2022, 3:47pm
2
What webpack version are you on?
(probably webpack5 if you created that aurelia-cli project “recently”)
If yes, webpack5 does not polyfill process (compared to webpack4)
To v5 from v4 | webpack → search for “process is not defined”.
I had to solve this as well, maybe you can get inspiration from:
PrimeDAO:development
← PrimeDAO:chore/webpack5
opened 10:20PM - 09 Feb 22 UTC
# What was done
- Follow the webpack migration guide: https://webpack.js.org/mi… grate/5/
- Based on the latest aurelia-cli update our webpack.config
- various fixes encountered in the process as well
- Update all webpack related loaders/packages
# Testing
0. npm ci
1. Prod
npm run build
npm run serve
2. Dev
npm run start-dev
3. E2e
npm run e2e-run
npm run e2e (then test on any test to verify it still runs)
# Issues ecountered
## optimization.moduleIds
WARNING in configuration
The value 'hashed' for option 'optimization.moduleIds' is deprecated. Use 'deterministic' instead.
## polyfills
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 23:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Users\hate_w\Desktop\dev\prime\prime-deals-dapp\node_modules\xhr2-cookies\dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./src/walletMenu/walletMenu.html 3:33-74
Module not found: Error: Can't resolve '/logomark.svg' in 'C:\Users\hate_w\Desktop\dev\prime\prime-deals-dapp\src\walletMenu'
## Warnings
###
extractCSS
###
WARNING in ./src/main.ts 38:8-27
Should not import the named export 'testing' (imported as 'environment') from default-exporting module (only default export is available soon)
@ ./node_modules/aurelia-webpack-plugin/runtime/empty-entry.js
###
(node:2412) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
- this package causes this // ...when(!tests, new DuplicatePackageCheckerPlugin()),
- https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin/issues/42
###
[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
1 Like
Any further details of what to look for this particular issue?
hiaux0
December 31, 2022, 10:08am
4
Are you encountering the same error?
And the PR I linked didn’t helped you?
It ultimately did, I had other issues still and didn’t come back here to update this. Thanks
1 Like