Skip to content

[IMP] loadable with nodejs#1810

Merged
ged-odoo merged 1 commit intomasterfrom
master-nodejs-lul
Mar 18, 2026
Merged

[IMP] loadable with nodejs#1810
ged-odoo merged 1 commit intomasterfrom
master-nodejs-lul

Conversation

@LucasLefevre
Copy link
Copy Markdown
Contributor

@LucasLefevre LucasLefevre commented Mar 18, 2026

We'd like to be able to execute o-spreadsheet server-side where the DOM and Web API's are not available.

We currently can't do it because loading the bundle file crashes because some DOM specifics are used at the root:

e.g. const elementProto = Element.prototype; => Element is not defined

One solution would be to create an other bundle for o-spreadsheet which would not depend on owl. And we actually did that already. The problem comes when we want to do the same for the odoo bundle. We depend on many parts of the framework (for core services, utils, etc.)

While it may not be entirely impossible to split the framework bundle, it'll be very fragile because any file dependy change may break it.

Also, with the up-coming Owl3, the framework will rely on owl (signals).

The plan is therefore to make the bundle loadable with nodejs (even if it
cannot be used!)

We'll use the regular bundle and it'll be our responsibility to only use
the parts that can work server-side.

My goal with this commit is:

npm run build
node dist/owl.cjs.js  <- should not crash

Task-5156838

We'd like to be able to execute o-spreadsheet server-side where the DOM
and Web API's are not available.

We currently can't do it because loading the bundle file crashes because
some DOM specifics are used at the root:

e.g. `const elementProto = Element.prototype;` => `Element` is not defined

One solution would be to create an other bundle for o-spreadsheet which
would not depend on owl. And we actually did that already.
The problem comes when we want to do the same for the odoo bundle.
We depend on many parts of the framework (for core services, utils, etc.)

While it may not be entirely impossible to split the framework bundle, it'll
be very fragile because any file dependy change may break it.

Also, with the up-coming Owl3, the framework will rely on owl (signals).

The plan is therefore to make the bundle loadable with nodejs (even if it
cannot be used!)

We'll use the regular bundle and it'll be our responsibility to only use
the parts that can work server-side.

My goal with this commit is:

```
npm run build
node dist/owl.cjs.js  <- should not crash
```

Task-5156838
@sdegueldre
Copy link
Copy Markdown
Contributor

Maybe we should build the bundle differently? Seems likes these files should not even be getting parsed if they're unused.

@ged-odoo
Copy link
Copy Markdown
Contributor

i agree with Sam, but in the meantime, this PR solves the issue for now

@ged-odoo ged-odoo merged commit efae3e4 into master Mar 18, 2026
2 checks passed
@ged-odoo ged-odoo deleted the master-nodejs-lul branch March 18, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants