webpack-contrib/install-webpack-plugin

`stylus` module is missing when used with `stylus-loader`

dmitriz opened this issue · 2 comments

It seems that neither stylus nor stylus-loader are installed automatically when running webpack with

// webpack.config.js
...
    loaders: [
      {
        test: /\.styl$/, 
        loaders: ['style', 'css', 'stylus']
      }
    ]
...

I had to install both modules manually to make it work.

I just tested out example/webpack1 with this:

diff --git a/example/webpack1/webpack.config.defaults.js b/example/webpack1/webpack.config.defaults.js
index 953cbf9..c4b2b12 100644
--- a/example/webpack1/webpack.config.defaults.js
+++ b/example/webpack1/webpack.config.defaults.js
@@ -10,6 +10,7 @@ module.exports = {
     loaders: [
       { test: /\.css$/, loader: "style" },
       { test: /\.css$/, loader: "css", query: { localIdentName: "[name]-[local]--[hash:base64:5]" } },
+      { test: /\.css$/, loader: "stylus" },
       { test: /\.eot$/, loader: "file" },
       { test: /\.js$/, loader: "babel", query: { cacheDirectory: true }, exclude: /node_modules/ },
       { test: /\.json$/, loader: "json" },
Listening on http://localhost:3000/
Installing stylus-loader...
webpack building...
webpack built 57cebbfad9ac9b4d1508 in 7992ms
Hash: 57cebbfad9ac9b4d1508
Version: webpack 1.12.15
Time: 7992ms
             Asset       Size  Chunks             Chunk Names
         client.js     364 kB       0  [emitted]  client
1.57ceb-4ca8acc.js  711 bytes       1  [emitted]
chunk    {0} client.js (client) 319 kB [rendered]
    [0] multi client 40 bytes {0} [built]
    [1] (webpack)-hot-middleware/client.js?reload=true 4.18 kB {0} [built]
[SNIP]
ERROR in Cannot find module 'stylus'
 @ ./lib/App/App.css 4:14-178 13:2-17:4 14:20-184
^C

stylus-loader installs correctly in the example, but of course stylus isn't installed automatically: it's not a peer dependency:

https://github.com/shama/stylus-loader/blob/bb872044801006a6953c429d857b7ba458a5eb66/package.json

I'm closing this because it's not really a bug in this project. I can hook into direct dependencies of a project (e.g. import stylus from "stylus") and even peerDependencies now, but this is outside of both of those.