Closed manoj-mukherjee-maersk closed 2 years ago
Example repo -> https://github.com/2manoj1/bpnmformjs clone it. For Reproduce
Hi,
Thanks for reporting this issue. It seems that the build tool (Terser) used by Next.js transforms the Validator to a function below:
> f.toString()
'function f(e){var t=l.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}'
Then, the didi dependency injection kicks in and tries to provide the cryptic "e" module which does not exist. I don't quite get it why the class is transformed this way, but can see a potential solution to the issue. We could try out if adding a line below fixes the problem:
Validator.$inject = []
We are happy to accept external contributions so if you want to provide a PR, you are welcome to do so.
Hi @barmac, I dont much idea and knowledge on form-js lib. Can you give some workaround or quick fix for production issue.
I think you could try to play with the configuration, but can't give you a ready-to-use solution as I lack knowledge on Next.js. Check out this: https://stackoverflow.com/questions/42300147/how-to-disable-in-webpack-to-rename-of-function-names-typescript-javascript
Latest nextjs does nott use Terser. swcMinify by default. https://nextjs.org/docs/upgrading#swc-replacing-terser-for-minification. Tried swcMinify: false but no luck of work.
I debug and found strict: undefined coming.
Its added to swc known issue. https://github.com/swc-project/swc/issues/2934 Ref: https://github.com/vercel/next.js/discussions/30237#discussioncomment-2420601
Not sure if this is an issue of swc, considering that it fails even with swcMinify: true
(Actually it's very unlikely buf of swc)
The solution to the issue is in https://github.com/bpmn-io/form-js/issues/240#issuecomment-1075526031 It's not an swc issue but a problem with how dependency injection form-js works.
@barmac When this fix available so I will test?
@barmac not able test this. Its showing close issue but not get any releases.
Indeed, this will be possible when we release the library. This should happen rather soon.
Happening pretty soon: https://github.com/bpmn-io/form-js/pull/243
@manoj-mukherjee-maersk Please verify it's fixed with v0.7.1
Its fixed. Thank you 😊.
marker
I got the same problem in webpack, optimization.minimize = true
, it's caused by terser plugin? @barmac ,Please help me !
I got the same problem in webpack,
optimization.minimize = true
, it's caused by terser plugin? @barmac ,Please help me !
form-js 1.8.6
I got the same problem in webpack,
optimization.minimize = true
, it's caused by terser plugin? @barmac ,Please help me !
And error echo: Error: No provider for "e"! (Resolving: fileUploadField -> e)
fileUploadField is my custom field
Please read this part carefully: https://github.com/bpmn-io/form-js/issues/240#issuecomment-1075526031
You need to add proper $inject
field for minimized code to work.
You need to add proper
$inject
field for minimized code to work.
FileUploadPropertiesProvider.$inject = ['propertiesPanel']
already in custom properties panel.
I followed the example https://github.com/bpmn-io/form-js-examples/blob/master/custom-components/app/extension/render/index.js , At last, I've figured it out that missing $inject in custom fields render class, like this FileUploadFields.$inject = ['formFields']
in render index.js
Describe the Bug
Getting below error on running the project in production build. It's working fine in dev build.
Uncaught Error: No provider for "e"! (Resolving: validator -> e)
Steps to Reproduce
yarn create next-app --typescript
yarn add @bpmn-io/form-js
import "@bpmn-io/form-js/dist/assets/form-js.css";
const FormViewer = () => { useEffect(() => { const data = { creditor: "John Doe Company", amount: 456, invoiceNumber: "C-123", approved: true, approvedBy: "John Doe", };
}, []); return
; };export default FormViewer;
Expected Behavior
In production build no error and onSubmit should work.
Environment