Last active
November 26, 2019 01:55
-
-
Save atomicpages/f6d534f6e1ed74146758de70ecde9cb3 to your computer and use it in GitHub Desktop.
Minimum verifiable example of JSON import using pika
This file contains hidden or 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
import locales from './translation.json'; | |
console.log(locales.en['Hello, {{name}}'].replace('{{name}}', 'Dennis')); |
This file contains hidden or 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
{ | |
"name": "json-import-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"clean": "shx rm -rf pkg/", | |
"build": "npm run clean && pika build" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@pika/pack": "^0.5.0", | |
"@pika/plugin-build-node": "^0.8.1", | |
"@pika/plugin-build-web": "^0.8.1", | |
"@pika/plugin-copy-assets": "^0.8.1", | |
"@pika/plugin-ts-standard-pkg": "^0.8.1", | |
"prettier": "^1.19.1", | |
"shx": "^0.3.2", | |
"typescript": "^3.7.2" | |
}, | |
"@pika/pack": { | |
"pipeline": [ | |
[ | |
"@pika/plugin-ts-standard-pkg" | |
], | |
[ | |
"@pika/plugin-build-node" | |
], | |
[ | |
"@pika/plugin-build-web" | |
] | |
] | |
}, | |
"prettier": { | |
"tabWidth": 4, | |
"singleQuote": true, | |
"trailingComma": "es5" | |
} | |
} |
This file contains hidden or 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
{ | |
"en": { | |
"Hello, {{name}}": "Hello, {{name}}" | |
}, | |
"es": { | |
"Hola, {{name}}": "Hola, {{name}}" | |
}, | |
"fr": { | |
"Bonjur, {{name}}": "Bonjur, {{name}}" | |
} | |
} |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"esModuleInterop": true, | |
"downlevelIteration": true, | |
"lib": ["es2015"], | |
"moduleResolution": "node", | |
"resolveJsonModule": true, | |
"module": "ESNext", | |
"target": "es2019" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment