New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack configuration for bundling libraries compatible with flutter_js #38
Comments
I solved the issue, the eval of the library failed, as I used some syntax which WebKit on MacOS didn't support yet. Took me some time to figure out that I'll only see syntax errors when wrapping the line |
@fbennets i am also using some custom library bundled with webpack but i am getting error |
I guess that's not an Webpack issue. In a browser environment Oh remember that loading the .js file with the root bundle - as in the AJV example - is asynchronous. Make sure that you await until the library is fully loaded. |
@fbennets I want to load js bundle in my flutter app
|
Hi @fbennets do you have some example ? I can't manage to run a js library that I bundled with webpack.
and then I loaded the file with flutter_js and executed it like so:
So far no problems, it is working.
Moved the bundled file instead of my test.js in Flutter that was working before, but then no way to have it working whatever I do:
I always get the: What am I doing wrong ? Thanks a lot in advance |
found a solution using: in my webpack config |
Hi @abner,
first and foremost, thank you for this awesome library!
I have currently have an issue where I am trying to load our own JavaScript library which is bundled with webpack as an UMD library. I managed load a generic JavaScript file containing some test functions and executing them afterwards using the AJV example. Loading the bundled library in a browser using a "script"-tag in an HTML-file works fine, its available in the window/global namespace. However, when I'm trying to load the library using flutter_js, it does not become available in the global namespace.
I saw you mentioning that you are using webpack to bundle libraries you load into flutter_js. Therefore, I wanted to ask if you could kindly share your webpack.config.js and how you are exporting you library to the global namespace? Afterwards I could do a PR to enhance to documentation on how to embed libraries, if you'd like me to.
This is the library I am trying to embed:
index.js
The export in the library is done this way:
I also tried
export default class {...}
which also worked fine in a browser but not in flutter_js.This is the webpack.config.js:
The loading of the library in flutter follows your example:
However, in the following calls,
global.OpenDecisionJSCore
is undefined.I'd really appreciate some guidance!
The text was updated successfully, but these errors were encountered: