1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/server/build/loaders/emit-file-loader.js
Naoyuki Kanezawa 12f31b5bf3 Source map support (#279)
* generate source-maps on development

* remove unused dep
2016-12-02 10:43:38 +09:00

17 lines
507 B
JavaScript

import loaderUtils from 'loader-utils'
module.exports = function (content, sourceMap) {
this.cacheable()
const query = loaderUtils.parseQuery(this.query)
const name = query.name || '[hash].[ext]'
const context = query.context || this.options.context
const regExp = query.regExp
const opts = { context, content, regExp }
const interpolatedName = loaderUtils.interpolateName(this, name, opts)
this.emitFile(interpolatedName, content, sourceMap)
this.callback(null, content, sourceMap)
}