Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imports-loader takes no effect when using autodll-webpack-plugin #44

Closed
arzyu opened this issue Jul 18, 2017 · 1 comment
Closed

imports-loader takes no effect when using autodll-webpack-plugin #44

arzyu opened this issue Jul 18, 2017 · 1 comment

Comments

@arzyu
Copy link

arzyu commented Jul 18, 2017

Here is my webpack.config.js.

const path = require("path");

const HtmlPlugin = require("html-webpack-plugin");
const AutodllPlugin = require("autodll-webpack-plugin");

module.exports = {
  context: path.resolve(__dirname, "src"),
  entry: {
    index: "./index.js"
  },
  output: {
    path: path.resolve(__dirname, "build"),
    filename: "[name].js"
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: "babel-loader"
      },
      {
        test: /pixi-layers/,
        use: {
          loader: "imports-loader",
          options: "PIXI=pixi.js"
        }
      }
    ]
  },
  plugins: [
    new HtmlPlugin({
      template: "index.ejs"
    }),
    new AutodllPlugin({
      inject: true,
      filename: "[name].[hash].js",
      entry: {
        vendor: ["pixi-layers", "pixi.js"]
      }
    })
  ]
};

Since pixi-layers use a global PIXI, I use imports-loader to add a PIXI import for pixi-layers. This makes pixi-layers work.

But after using autodll-webpack-plugin, imports-loader takes no effect, and pixi-layers raise an error Uncaught ReferenceError: PIXI is not defined.

See my demo: webpack-demo.zip

@asfktz
Copy link
Owner

asfktz commented Jul 18, 2017

Hi, @arzyu
Thanks for telling me about this!

This is related to #37 and It will be fixed in the next version.

By the way, I would love the hear your feedback on the proposed solution

Have a great day (:
Asaf

@arzyu arzyu closed this as completed Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants