Karma, webpack, compiled bootloader emblem undefined

We use a coffee script and logo template in the project. Webpack is used for bundling and Karma for running tests. I tried using emblem-loaderto process the logo with webpack. Here is the repository that I created with a simple example of how to play it.

karma webpack config (coffee-script):

webpack:
      module:
          loaders: [
              { test: /\.coffee$/, loader: "coffee-loader" },
              { test: /\.emblem$/, loader: "emblem-loader"}
          ],
      resolve:
        extensions: ["", ".emblem"]
    webpackMiddleware:
      noInfo: true

The template is imported through emblemTemplate = require 'template_path.emblem', then tries to do emblemTemplate(context).

Resulting errors:

  • in PhantomJS: Can't find variable: compiled
  • in Chrome: ReferenceError: compiled is not defined

The problem is definitely related to the processing of the template, and not to the template itself for the loader return function, which checks if (!compiled) {...}.

+4

Source: https://habr.com/ru/post/1627295/


All Articles