JSPM

react-native-jsonc-asset-plugin

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q28976F
  • License MIT

Asset plugin for compress jsonc in React Native

Package Exports

  • react-native-jsonc-asset-plugin
  • react-native-jsonc-asset-plugin/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-jsonc-asset-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-jsonc-asset-plugin

Usage

Step 1: Install

yarn add -D react-native-jsonc-asset-plugin

or

npm install --save-dev react-native-jsonc-asset-plugin

Step 2: Configure metro.config.js

For example;

const {getDefaultConfig} = require('metro-config');

module.exports = (async () => {
  const {resolver: {assetExts}} = await getDefaultConfig();
  return {
    resolver: {
      assetExts: [...assetExts, 'jsonc', 'json5'],
    },
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          inlineRequires: true,
          experimentalImportSupport: false,
        },
      }),
      assetPlugins: ['react-native-jsonc-asset-plugin'],
      jsoncAssetPlugin: {
        test: /\.(jsonc|json5)$/,
        tempDir: '.jsonc',
      },
    },
  };
})();