Skip to content
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

Use @handlebars/parser v2 #1866

Merged
merged 1 commit into from Oct 29, 2022
Merged

Use @handlebars/parser v2 #1866

merged 1 commit into from Oct 29, 2022

Conversation

jaylinski
Copy link
Member

@jaylinski jaylinski self-assigned this May 20, 2022
@jaylinski
Copy link
Member Author

jaylinski commented May 20, 2022

It seems the ts compilation (https://github.com/handlebars-lang/handlebars-parser/blob/v2.1.0/package.json#L23) does something that rollup.js doesn't like.

Note: typescript, when targeting es5, will use global this for transpilation. Rollup warns about this, since it replaces this with undefined:

> rollup-test@1.0.0 build
> rollup --config rollup.config.js --failAfterWarnings


src/index.js → dist/bundle.js...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
../../../node_modules/@handlebars/parser/dist/esm/printer.js
1: var __spreadArrays = (this && this.__spreadArrays) || function () {
                         ^
2:     for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
3:     for (var r = Array(s), k = 0, i = 0; i < il; i++)
...and 1 other occurrence
../../../node_modules/@handlebars/parser/dist/esm/helpers.js
1: var __spreadArrays = (this && this.__spreadArrays) || function () {
                         ^
2:     for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
3:     for (var r = Array(s), k = 0, i = 0; i < il; i++)
...and 1 other occurrence
created dist/bundle.js in 265ms
[!] Warnings occurred and --failAfterWarnings flag present

Fix would be to target es6 or run rollup and ignore the warning.

We have to remove `--failAfterWarnings` from our Rollup integration-test,
because Typescript, when targeting es5, will use global `this` for transpilation.
Rollup warns about this, since it replaces `this` with `undefined`:

```
src/index.js → dist/bundle.js...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
../../../node_modules/@handlebars/parser/dist/esm/printer.js
1: var __spreadArrays = (this && this.__spreadArrays) || function () {}
```

See https://github.com/handlebars-lang/handlebars-parser/releases/tag/v2.0.0
@jaylinski jaylinski merged commit e668696 into master Oct 29, 2022
12 checks passed
@jaylinski jaylinski deleted the parser-v2 branch October 29, 2022 20:09
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.

None yet

1 participant