Permalink
Browse files

packager: ModuleGraph: include all possible asset types

Summary: Afaik. the list of asset types is hardcoded for the Buck worker so far, and I'm not sure how that would be customizable. For now, let's include all the default asset extensions.

Reviewed By: davidaurelio

Differential Revision: D5002607

fbshipit-source-id: 41069e817d2b73156bca684bc2f73077132928a7
  • Loading branch information...
jeanlauliac authored and facebook-github-bot committed May 8, 2017
1 parent 2edbb61 commit e69b81313f68268c4425579b8196d771f042f858
Showing with 5 additions and 1 deletion.
  1. +5 −1 packager/src/ModuleGraph/worker/transform-module.js
@@ -12,8 +12,10 @@
const babel = require('babel-core');
const collectDependencies = require('./collect-dependencies');
const defaults = require('../../../defaults');
const docblock = require('../../node-haste/DependencyGraph/docblock');
const generate = require('./generate');
const path = require('path');
const series = require('async/series');
const {basename} = require('path');
@@ -39,12 +41,14 @@ const defaultVariants = {default: {}};
const moduleFactoryParameters = ['global', 'require', 'module', 'exports'];
const polyfillFactoryParameters = ['global'];
const ASSET_EXTENSIONS = new Set(defaults.assetExts);
function transformModule(
content: Buffer,
options: TransformOptions,
callback: Callback<TransformedSourceFile>,
): void {
if (options.filename.endsWith('.png')) {
if (ASSET_EXTENSIONS.has(path.extname(options.filename).substr(1))) {
transformAsset(content, options, callback);
return;
}

0 comments on commit e69b813

Please sign in to comment.