0.0.0 • Published 7 years ago
@webapp-loader/json v0.0.0
@webapp-loader/json
Embeds JSON as JavaScript. When applied, will inline a string of JSON that has been imported. All root keys are exposed as named exports, and the entire object is assembled as a default export.
npm install @webapp-loader/json --save-devUpdate your .webapp.json:
{
"loaders": {
"*.json": "@webapp-loader/json"
}
}Now you can import JSON from any module, and even pick out a single value, due to tree-shaking.
import { version } from './package.json';
console.log(version);The bundle would only include the version:
const version = "0.0.0";
console.log('Current version of this loader', version);And the optimized build would look like:
const a='0.0.0';console.log('Current version of this loader', a);0.0.0
7 years ago