GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

BUG: Building on Windows 10+ #5742

Closed bernesto closed 7 months ago

bernesto commented 7 months ago

GrapesJS version

What browser are you using?

Chrome v122

Reproducible demo link

N/A

Describe the bug

How to reproduce the bug?

  1. Checkout git onto a Windows 10+ machine
  2. Build using provided procedure.

What is the expected behavior? It should build the same as in a *inx system.

What is the current behavior? The build fails with errors referencing Backbone:

WARNING in ./src/common/index.ts 35:2-16
export 'default' (imported as 'Backbone') was not found in 'backbone' (module has no exports)
 @ ./src/editor/view/EditorView.ts 16:0-39 45:21-22 68:2-6
 @ ./src/editor/index.ts 60:0-43 866:30-40
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/common/index.ts 43:2-21
export 'default' (imported as 'Backbone') was not found in 'backbone' (module has no exports)
 @ ./src/editor/view/EditorView.ts 16:0-39 45:21-22 68:2-6
 @ ./src/editor/index.ts 60:0-43 866:30-40
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/common/index.ts 51:2-15
export 'default' (imported as 'Backbone') was not found in 'backbone' (module has no exports)
 @ ./src/editor/view/EditorView.ts 16:0-39 45:21-22 68:2-6
 @ ./src/editor/index.ts 60:0-43 866:30-40
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/dom_components/model/Component.ts 1597:18-45
export 'Model' (imported as 'Model') was not found in 'backbone' (module has no exports)
 @ ./src/dom_components/index.ts 97:0-74 262:23-32 267:26-35 588:30-39 588:41-56
 @ ./src/editor/model/Editor.ts 91:0-52 138:4-20
 @ ./src/editor/index.ts 59:0-41 79:22-33
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/dom_components/model/Component.ts 1625:25-53
export 'Model' (imported as 'Model') was not found in 'backbone' (module has no exports)
 @ ./src/dom_components/index.ts 97:0-74 262:23-32 267:26-35 588:30-39 588:41-56
 @ ./src/editor/model/Editor.ts 91:0-52 138:4-20
 @ ./src/editor/index.ts 59:0-41 79:22-33
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/editor/model/Editor.ts 113:0-10
export 'default' (imported as 'Backbone') was not found in 'backbone' (module has no exports)
 @ ./src/editor/index.ts 59:0-41 79:22-33
 @ ./src/index.ts 13:0-30 61:25-31

WARNING in ./src/undo_manager/index.ts 76:23-34
export 'default' (imported as 'UndoManager') was not found in 'backbone-undo' (module has no exports)
 @ ./src/editor/model/Editor.ts 108:0-51 118:4-21
 @ ./src/editor/index.ts 59:0-41 79:22-33
 @ ./src/index.ts 13:0-30 61:25-31

Environment:

Windows Server 2022 (fresh image)
VS Code 1.87.1 (latest)
Node v21.4.0 (latest)
All npm updates applied

This 'may' be related to GrapesJS CLI, I am not sure, as changes to the webpack.config.js, tsconfig.json seem to have no effect.

I have also tried building it directly, and it seems the Backbone may be having an issue using cash-dom instead of jquery.

Hitting a wall on this one.

Code of Conduct

artf commented 7 months ago

Yeah build/serve are managed by the CLI (let's move the issue there) but I'm not sure what might be the problem (no Windows to test 🥲)

bernesto commented 7 months ago

Okay, I was suspecting it was at the CLI as well. I added some debugging code to check the output of the webpack.config.js at runtime. I did find and correct some backslash vs. forward slash path issues in the generated output, but it didn't correct the original issue.

If I spin you up a Windows vm in AWS with everything you need, could you take a look? Maybe I am missing something.

artf commented 7 months ago

If I spin you up a Windows vm in AWS with everything you need, could you take a look? Maybe I am missing something.

I'm not sure when I'll be able to find time to check it honestly so don't do it 😅

Anyway, did you try to install it with yarn --frozen-lockfile?

bernesto commented 7 months ago

Yeah, I did all the usual stuff. Lock files, updates, various ways of imports ({}, require, *, full path, etc.)

Not sure why, but when I break stuff, I break it good. Always tier 2 or 3 support LMAO.

I do believe the issue resides in CLI, or... in conjunction with backbone-undo. Maybe path related, or symlinks, or... ¯_(ツ)_/¯

Anyway, I get the 'time' element. I burned too much time on it already, let me know if you get the itch lol

artf commented 6 months ago

I'd say this is not path-related issue, otherwise, you'd get another error (eg. unable to load module). Worth noting that export 'default' (imported as 'X') was not found in 'Y' in the context of backbone/backbone-undo is technically correct as those are UMD bundled, but Webpack should apply some kind of interoperability wrapper and make them work as es modules, so for some reason this thing breaks on Windows.

I'm wondering if it might be related to the node version?! Did you try with v16/v18?

bernesto commented 6 months ago

Good points. I have not tried the other versions of Node. I will give that a shot.