Repository: parcel-bundler/parcel
File: packages/transformers/webextension/src/WebExtensionTransformer.js (JavaScript)

Code before:
        currentFiles = currentFiles.concat(globFiles);
      }
      if (isMV2) {
        war = war.concat(currentFiles);
      } else {
        currentEntry.resources = currentFiles;
        war.push(currentEntry);
      }
    }
    program.web_accessible_resources = war;
  }
  if (program.declarative_net_request) {
    const rrs: {|path: string, id: string, enabled: boolean|}[] =
      program.declarative_net_request?.rule_resources ?? [];
    rrs.forEach((resources, i) => {
      const loc = {
        filePath,
        ...getJSONSourceLocation(
          ptrs[`/declarative_net_request/rule_resources/${i}/path`],
          'value',
        ),
      };

      asset.addURLDependency(resources.path, {
        needsStableName: true,
        pipeline: 'isolated',
        loc,
      });
    });
  }

  for (const loc of DEP_LOCS) {
    const location = '/' + loc.join('/');
    if (!ptrs[location]) continue;
    let parent: any = program;
    for (let i = 0; i < loc.length - 1; ++i) {
      parent = parent[loc[i]];
    }
    const lastLoc = loc[loc.length - 1];
    const obj = parent[lastLoc];
    if (typeof obj == 'string')
      parent[lastLoc] = asset.addURLDependency(obj, {
        bundleBehavior: 'isolated',
        loc: {
          filePath,
          ...getJSONSourceLocation(ptrs[location], 'value'),
        },
        pipeline: path.extname(obj) == '.json' ? 'raw' : undefined,
      });
    else {
      for (const k of Object.keys(obj)) {

Review comment (suggestion):
I think you probably want `pipeline: 'raw'` here; there is no such thing as `'isolated'`. JSON files get transformed to JS by default but you can prevent that with the `'raw'` pipeline (this only works in web extension builds).

Code after:
          }),
        );
        currentFiles = currentFiles.concat(globFiles);
      }
      if (isMV2) {
        war = war.concat(currentFiles);
      } else {
        currentEntry.resources = currentFiles;
        war.push(currentEntry);
      }
    }
    program.web_accessible_resources = war;
  }
  if (program.declarative_net_request) {
    const rrs: {|path: string, id: string, enabled: boolean|}[] =
      program.declarative_net_request?.rule_resources ?? [];
    rrs.forEach((resources, i) => {
      resources.path = asset.addURLDependency(resources.path, {
        pipeline: 'raw',
        loc: {
          filePath,
          ...getJSONSourceLocation(
            ptrs[`/declarative_net_request/rule_resources/${i}/path`],
            'value',
          ),
        },
      });
    });
  }

  for (const loc of DEP_LOCS) {
    const location = '/' + loc.join('/');
    if (!ptrs[location]) continue;
    let parent: any = program;
    for (let i = 0; i < loc.length - 1; ++i) {
      parent = parent[loc[i]];
    }
    const lastLoc = loc[loc.length - 1];
    const obj = parent[lastLoc];
    if (typeof obj == 'string')
      parent[lastLoc] = asset.addURLDependency(obj, {
        bundleBehavior: 'isolated',
        loc: {
          filePath,
          ...getJSONSourceLocation(ptrs[location], 'value'),
        },
        pipeline: path.extname(obj) == '.json' ? 'raw' : undefined,
      });
    else {
      for (const k of Object.keys(obj)) {
        obj[k] = asset.addURLDependency(obj[k], {