Skip to content

Commit

Permalink
packager: ModuleGraph: include all possible asset types
Browse files Browse the repository at this point in the history
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
Jean Lauliac authored and facebook-github-bot committed May 8, 2017
1 parent 2edbb61 commit e69b813
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packager/src/ModuleGraph/worker/transform-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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;
}
Expand Down

0 comments on commit e69b813

Please sign in to comment.