grcoder
grcoder

Reputation: 333

webpack HtmlWebpackPlugin wont create link css tag

Im experiencing a problem with webpack.

The plugin HtmlWebpackPlugin is not creating the tag And I cant figure it out why. Only the JS tag is included.

as plugins I have

  new HtmlWebpackPlugin({
    inject: false,
    // hash: true,
    template: __dirname + '/../src/app/Views/layouts/layout-template.phtml',
    filename: __dirname + '/../src/app/Views/layouts/layout.phtml',
  }),
  new MiniCssExtractPlugin({
    filename: 'css/[name].css'
  })

as rules:

  {
    test: /\.(sa|sc|c)ss$/,
    use: [
      {
        loader: MiniCssExtractPlugin.loader,
      },
      'css-loader',
      'postcss-loader',
      'sass-loader',
    ],
  },

I would appreciate help. Thanks.

Upvotes: 0

Views: 740

Answers (2)

grcoder
grcoder

Reputation: 333

I just figure it out. I needed to include the scss also as an entry point.

entry: {
      main: [
        './src/private/index.js',
        './src/private/scss/style.scss'
      ],
},

I'm kinda new to webpack, and the documentation or examples, or are outdated or confusing.

Upvotes: 1

felixmosh
felixmosh

Reputation: 35473

You are telling to HTMLWebpackPlugin not to inject them by inject: false. Just remove inject: false attribute.

Upvotes: 1

Related Questions