Skip to content

Commit

Permalink
Fix .json import error
Browse files Browse the repository at this point in the history
This is a regression we've added by vercel#926 (tree-shaking-support)
  • Loading branch information
arunoda committed Feb 1, 2017
1 parent f3e541f commit 1985cae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/build/loaders/emit-file-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (content, sourceMap) {
}

if (query.transform) {
const transformed = query.transform({ content, sourceMap })
const transformed = query.transform({ content, sourceMap, interpolatedName })
return emit(transformed.content, transformed.sourceMap)
}

Expand Down
7 changes: 6 additions & 1 deletion server/build/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ export default async function createCompiler (dir, { dev = false, quiet = false
// By default, our babel config does not transpile ES2015 module syntax because
// webpack knows how to handle them. (That's how it can do tree-shaking)
// But Node.js doesn't know how to handle them. So, we have to transpile them here.
transform ({ content, sourceMap }) {
transform ({ content, sourceMap, interpolatedName }) {
// Only handle .js files
if (!(/\.js$/.test(interpolatedName))) {
return { content, sourceMap }
}

const transpiled = babelCore.transform(content, {
presets: ['es2015'],
sourceMaps: dev ? 'both' : false,
Expand Down

0 comments on commit 1985cae

Please sign in to comment.