UNPKG

edge-fe-meta-loader

Version:

Edge Platform FE Meta Template loader for webpack

36 lines (25 loc) 950 B
# edge-fe-meta-loader for Webpack [JS-YAML](https://github.com/nodeca/js-yaml) loader for webpack. ## Installation `npm install edge-fe-meta-loader` ## Usage [Webpack documentation on using loaders.](https://webpack.js.org/concepts/loaders/#using-loaders) Using the loader inline: ``` javascript import doc from 'edge-fe-meta-loader!./file.yml'; // => returns a javascript object. see https://github.com/nodeca/js-yaml ``` Or using the loader via Webpack configuration (recommended): ``` javascript // webpack.config.js module: { rules: [{ test: /\.mt\.ya?ml$/, use: 'edge-fe-meta-loader', }] } ``` In contrast, this loader loads YAML files as JavaScript objects using the [un-eval](https://github.com/tiansh/un_eval.js) library. This allows YAML value types otherwise disallowed in JSON such as `Infinity`, `RegExp`, `Function`, etc. [See js-yaml's supported YAML types](https://github.com/nodeca/js-yaml#supported-yaml-types)