question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template cannot be applied as TemplateArgument: HarmonyImportDependency

See original GitHub issue

I can’t understand what it means. It’s a bug? Maybe, I doing something wrong?

error stack:

vendor.js
Template cannot be applied as TemplateArgument: HarmonyImportDependency
Error: Template cannot be applied as TemplateArgument: HarmonyImportDependency
    at TemplateArgumentDependencyTemplate.TemplateArgumentDependency.Template.apply (/home/mixtape/web/repo/gmail/node_modules/webpack/
lib/dependencies/TemplateArgumentDependency.js:24:46)
    at doDep (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/NormalModule.js:227:12)
    at Array.forEach (native)
    at doBlock (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/NormalModule.js:243:22)
    at NormalModule.source (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/NormalModule.js:278:2)
    at ModuleTemplate.render (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/ModuleTemplate.js:15:28)
    at ChunkTemplate.Template.renderChunkModules (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/Template.js:115:31)

    at ChunkTemplate.render (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/ChunkTemplate.js:18:21)
    at Compilation.createChunkAssets (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/Compilation.js:847:34)
    at Compilation.<anonymous> (/home/mixtape/web/repo/gmail/node_modules/webpack/lib/Compilation.js:556:9)

my env: linux debian nodejs 5.11.0 webpack 2.1.0-beta.8

my webpack config:

"use strict";

const path     = require("path");
const webpack  = require("webpack");
const aprefix  = require("autoprefixer");
const annotate = require("ng-annotate-webpack-plugin");
const isDev    = require("./environments").isDev;
const isWatch  = require("./environments").isWatch;

module.exports = function(root) {

  let options = {
    watch: isWatch,
    context: root,
    entry: {
      app: ["./client/js/index.js"],
      vendor: ["angular"]
    },
    output: {
      path: path.join(root, "./server/public/assets/js/"),
      filename: "[name].js",
      chunkFilename: "[id].js",
      publicPath: "",
      pathinfo: isDev
    },
    debug: isWatch,
    devtool: isWatch ? "#inline-source-map" : null,
    resolve: {
      modules: [root, "node_modules"],
      extensions: [".js"],
      enforceModuleExtension: false,
      enforceExtension: false,
      mainFields: ["main"],
      descriptionFiles: ["package.json"]
    },
    resolveLoader: {
      modulesDirectories: ["node_modules"],
      extensions: ["", ".loader.js", ".js"],
      moduleTemplates: ["*-loader", "*"]
    },
    plugins: [
      new webpack.NoErrorsPlugin(),
      new webpack.optimize.CommonsChunkPlugin({
        name: "vendor",
        minChunks: Infinity
      })
    ],
    module: {
      loaders: [{
        test: /\.js$/,
        loader: "babel-loader",
        include: [
          path.join(root, "./client")
        ],
        query: {
          presets: ["es2015-webpack"]
        }
      }, {
        test: /\.html$/,
        loader: "html-loader",
        include: [
          path.join(root, "./client")
        ],
        query: {
          attrs: false
        }
      }, {
        test: /\.styl$/,
        loader: isDev ? "style-loader!css-loader!postcss-loader!stylus-loader?resolve url"
                      : "style-loader!css-loader?minimize!postcss-loader!stylus-loader?resolve url"
      }, {
        test: /\.svg$/,
        loader: "svg-url-loader!svgo-loader"
      }],
      noParse: [
        /angular\/angular.js/
      ]
    },
    postcss: function () {
      return [aprefix({
        browsers: ["last 2 versions", "Firefox ESR", "ie >= 9"]
      })];
    }
  };

  if (!isDev) {
    options.plugins.push(
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          "warnings": false,
          "drop_debugger": true,
          "drop_console" : true,
          "unsafe": true
        }
      }),
      new annotate()
    );
  }

  if (!isWatch) {
    options.plugins.push(
      new webpack.optimize.DedupePlugin()
    );
  }

  return options;
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

13reactions
sokracommented, Jun 15, 2016

The template for the DedupePlugin is missing for harmony imports. As workaround disable the DedupePlugin.

10reactions
Martin-Luftcommented, Oct 4, 2016

You can’t use the DedupePlugin with wbepack2 and Angular 2 until https://github.com/webpack/webpack/issues/2644 is solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rangle/rangle-starter - Gitter
[chunkhash].js Template cannot be applied as TemplateArgument: HarmonyImportDependency Child html-webpack-plugin for "index.html": + 1 hidden modules.
Read more >
What does "unspecialized class template can't be used as a ...
AbstractRManagers names a template, which isn't a type -- it has to have a template parameter give to become a type.
Read more >
Partial template specialization - cppreference.com
The following restrictions apply to the argument-list of a partial template specialization: 1) The argument list cannot be identical to the non-specialized ...
Read more >
Deducing non-type template arguments - IBM
The compiler cannot deduce the value of a non-type template argument used in an expression in the template function's parameter list.
Read more >
7 Features of C++17 that will simplify your code - CodinGame
Template argument deduction for class templates ... is a template class, and template classes could not apply type deduction in their initialization.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found