Note: This page covers Parcel 1, the documentation for Parcel 2 is being worked on here: parcel2.zcopy.site

JSON

支持扩展类型:json, json5

在 js 中导入 json 文件:import data from './filename.json'

例子:

.
├── package.json
└── src
    ├── data.json
    └── index.js
{
  "hello": ["world", "computer"]
}
// index.js

import data from './data.json'
console.log(data.hello[0])

// "world"