summaryrefslogtreecommitdiff
path: root/loaders/demo-loader.js
blob: 5860feeccbfb3b0dc17099f9bf74f01a5489354d (plain)
1
2
3
4
5
6
7
8
9
10
const loaderUtils = require("loader-utils");

module.exports = function(content) {
  const { name } = loaderUtils.getOptions(this);
  const url = loaderUtils.interpolateName(this, name, { content });
  this.emitFile(url, content);

  const path = `__webpack_public_path__ + ${JSON.stringify(url)};`;
  return `export default ${path}`;
};