-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rollup warning when importing Handlebars as ESM
Closes #1696
- Loading branch information
Showing
8 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['eslint:recommended', 'prettier'], | ||
env: { | ||
browser: true | ||
}, | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 6 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "rollup-test", | ||
"description": "Various tests with Handlebars and rollup", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"build": "rollup --config rollup.config.js --failAfterWarnings" | ||
}, | ||
"private": true, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^13.1.1", | ||
"handlebars": "file:../../..", | ||
"rollup": "^2.61.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
|
||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/bundle.js', | ||
format: 'es' | ||
}, | ||
plugins: [nodeResolve()] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Handlebars from 'handlebars/lib/handlebars'; | ||
|
||
const template = Handlebars.compile('Author: {{author}}'); | ||
const result = template({ author: 'Yehuda' }); | ||
|
||
if (result !== 'Author: Yehuda') { | ||
throw Error('Assertion failed'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Cleanup: package-lock and "npm ci" is not working with local dependencies | ||
rm dist package-lock.json -rf | ||
npm install | ||
npm run build | ||
|
||
node dist/bundle.js | ||
echo "Success" |