V
V
vruzin2019-04-03 21:10:23
webpack
vruzin, 2019-04-03 21:10:23

Managed to make friends with Webpack 4 + Stylus ???

Gentlemen, I have already spent several days making friends with Webpack 4 and Stylus. Can someone share a WORKING template on GitHub??? Otherwise, the real examples that are given in screencasts and all sorts of "pros" on sites do not work with the current versions of Webpack and Stylus. THANK YOU SO MUCH in advance!!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
grinat, 2019-04-03
@grinat

Does the example from https://github.com/shama/stylus-loader not work? What mistake?
Here is a working example:
https://github.com/vuetifyjs/vuetify/blob/bb3ef969...
https://github.com/vuetifyjs/vuetify/blob/bb3ef969...

V
vruzin, 2019-04-05
@vruzin

Yes, all examples that are give errors. Alas!!! Dark error! Or rather, not so, errors everywhere! Here is the only option where there are no errors.

const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  entry:     {
    app: './src/index.js',
  },
  output:    {
    filename:   '[name].js',
    path:       path.resolve(__dirname, './dist'),
    publicPath: '/dist'
  },
  module:    {
    rules: [
      { test:   /\.js$/, loader: 'babel-loader', exclude: /(node_modules|bower_components)/},
      { test: /\.styl$/,
        use: [
          {loader: MiniCssExtractPlugin.loader, options: {publicPath: '/dist'}},
          {loader: "css-loader"},
          {loader: "stylus-loader"}
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: "[name].css",
      chunkFilename: "[id].css"
    })
  ]
};

"devDependencies": {
    "@babel/core": "^7.4.0",
    "@babel/preset-env": "^7.4.2",
    "autoprefixer": "^9.5.0",
    "babel-loader": "^8.0.5",
    "css-loader": "^2.1.1",
    "mini-css-extract-plugin": "^0.5.0",
    "path": "^0.12.7",
    "postcss-loader": "^3.0.0",
    "style-loader": "^0.23.1",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "webpack": "^4.29.6",
    "webpack-cli": "^3.3.0",
    "webpack-dev-server": "^3.2.1"
  }

Then when I finish my template, I will put it on GitHub and give a link.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question