Skip to content

Commit

Permalink
fix(loader): use ES2017 loader
Browse files Browse the repository at this point in the history
The ES5 polyfill included in the default loader messes with prettyDOM, which is used by testing-library. To fix this, we patch the loader package.json, the react and the vue output target imports to use the ES2017 code.

Fixes #699
  • Loading branch information
borisdiakur committed May 12, 2023
1 parent 5e4403c commit a079410
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/patchLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs')
const packageJSON = require('../dist/loader/package.json')
const patchedPackageJSON = {
...packageJSON,
main: packageJSON.main.replace('.cjs', ''),
main: packageJSON.main.replace('.cjs', '.es2017'),
type: 'module',
}
fs.writeFileSync(
Expand Down
2 changes: 1 addition & 1 deletion scripts/patchReactOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fs.readFile(filename, 'utf8', function (err, data) {
)
.replace(
"import { defineCustomElements } from '../dist/components/dist/loader/index.js';",
"import { defineCustomElements } from '../dist/loader/index.js';"
"import { defineCustomElements } from '../dist/loader/index.es2017.js';"
)

fs.writeFile(filename, result, 'utf8', function (err) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/patchVueOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fs.readFile(filename, 'utf8', function (err, data) {
)
.replace(
"import { defineCustomElements } from '../dist/components/dist/loader/index.js';",
"import { defineCustomElements } from '../dist/loader/index.js';"
"import { defineCustomElements } from '../dist/loader/index.es2017.js';"
)

fs.writeFile(filename, result, 'utf8', function (err) {
Expand Down

1 comment on commit a079410

@vercel
Copy link

@vercel vercel bot commented on a079410 May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

liquid – ./

liquid-git-main-uxsd.vercel.app
liquid-uxsd.vercel.app
liquid-oxygen.vercel.app

Please sign in to comment.