Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
Fixed zip download with presets
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Mar 19, 2017
1 parent 0828357 commit 27aba9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/createLoaders.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module.exports = function (currentLoaders) {
module.exports = function (currentLoaders, resolve) {

var loaders = [];

Expand All @@ -19,29 +19,29 @@ module.exports = function (currentLoaders) {
}
};
if (currentLoaders.babel.es2015) {
loader.query.presets.push(require.resolve('babel-preset-es2015'));
loader.query.presets.push(resolve('babel-preset-es2015'));
}
if (currentLoaders.babel.react) {
loader.query.presets.push(require.resolve('babel-preset-react'));
loader.query.presets.push(resolve('babel-preset-react'));
}
if (currentLoaders.babel.stage0) {
loader.query.presets.push(require.resolve('babel-preset-stage-0'));
loader.query.presets.push(resolve('babel-preset-stage-0'));
}
if (currentLoaders.babel.jsx) {
loader.query.plugins.push([
require.resolve('babel-plugin-transform-react-jsx'), {
resolve('babel-plugin-transform-react-jsx'), {
pragma: currentLoaders.babel.jsx.pragma
}
]);
}
if (currentLoaders.babel.decorators) {
loader.query.plugins.push(require.resolve('babel-plugin-transform-decorators-legacy'))
loader.query.plugins.push(resolve('babel-plugin-transform-decorators-legacy'))
}
if (currentLoaders.babel.classProperties) {
loader.query.plugins.push(require.resolve('babel-plugin-transform-class-properties'))
loader.query.plugins.push(resolve('babel-plugin-transform-class-properties'))
}
if (currentLoaders.babel.inferno) {
loader.query.plugins.push(require.resolve('babel-plugin-inferno'))
loader.query.plugins.push(resolve('babel-plugin-inferno'))
}

loaders.push(loader);
Expand Down
2 changes: 1 addition & 1 deletion src/sessionBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
modules: [path.resolve('node_modules'), path.join('/', 'node_modules')]
},
module: {
loaders: createLoaders(session.loaders)
loaders: createLoaders(session.loaders, require.resolve.bind(require))
},
plugins: manifest ? [
new webpack.DllReferencePlugin({
Expand Down
3 changes: 2 additions & 1 deletion src/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = function (req, res) {
"license": "ISC"
};

var loaders = createLoaders(req.session.loaders || {}).map(function (loader) {
var resolve = function (value) { return value; };
var loaders = createLoaders(req.session.loaders || {}, resolve).map(function (loader) {
loader.test = '$$' + loader.test.toString() + '$$';
if (loader.exclude) {
loader.exclude = '$$' + loader.exclude.toString() + '$$';
Expand Down

0 comments on commit 27aba9c

Please sign in to comment.