Closed eugenio165 closed 2 years ago
@eugenio165 Have you solved yet? @artf Any idea why this is happening? I am also facing this issue.
@MudassarSandhu Yes, unfortunately i had to disable aot and buildOptimizer on my prod build... If you find a better solution, update me please, thanks
Yeah, i did find a solution which fixed my error. How are you importing and initializing the grapesjs-preset-webpage plugin? Use the old method like
import grapesjs from 'grapesjs';
import 'grapesjs-preset-webpage';
And in the initialization of builder
plugins: ['grapesjs-preset-webpage'],
pluginsOpts: {
'gjs-preset-webpage': {
},
}
}
Add the grapesjs script and plugin script in angular json file in scripts tag like this But order matters if you have any other script in the scripts tag
"scripts": [
"./node_modules/grapesjs/dist/grapes.min.js",
"./node_modules/grapesjs-preset-webpage/dist/grapesjs-preset-webpage.min.js",
]
I see... so you can build with prod configurations like that? You didnt have to use my fix (disable AOT and Optimization)?
My implementation is exactly like yours, but my grapesjs scripts aren't the first in the array in the angular json file. I'm too busy currently to go back and try to play around with the project i used this on, but once i have time i'll go check if placing the grapesjs scrips first in the array allows me to build with AOT and Optimization.
@eugenio165 yeah i can build with prod configurations. In my project's anular.json file, grapesjs is not the first. I have imported other scripts but i showed you that as an example.
@MudassarSandhu Just to be clear, i can build with prod configurations, but i'll get the error i stated in this issue. When i build without AOT and BuildOptimizer, this error doesnt occur. My implementation is EXACTLY like yours, the only thing that could differ is the order of the scripts array, and maybe the order of the imports in the file i use grapesjs in.
When you build in prod, does grapesjs work correctly? Thanks mate
For now, I'm closing this as I can't reproduce it, but if you believe the issue is still there, please create a reproducible demo.
Hi! Thanks for the awesome package! It is very useful!
This is related to https://github.com/artf/grapesjs/issues/2658
I am using grapejs with this preset in Angular 7, while i use in development (ng serve) it works fine. But once i build the project, i get this error in the console:
ERROR TypeError: r is not a function
. It is caused by this package, not by grapesjs itself. I've traced down the error to the source code and it refers to this: which refers to line 14 in the source code ofsrc/commands/index.js
: https://github.com/artf/grapesjs-preset-webpage/blob/3e5a9e12998c9a32b6f1199953084163678e6c17/src/commands/index.js#L12-L16In this context,
r
isopenImport
and as the error states, is not a function. Keep in mind this happens only when i build in prod, so heres my config for angular:Thanks in advance!