Skip to content

path not working (output location) #137

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

Closed
jairusd opened this issue May 9, 2018 · 6 comments
Closed

path not working (output location) #137

jairusd opened this issue May 9, 2018 · 6 comments

Comments

@jairusd
Copy link

jairusd commented May 9, 2018

Hi, I specified the path in the plugin MiniCssExtractPlugin options but it keeps getting generated in my default output path that i also specified in my webpack. Can anyone help me in this issue? :) thanks

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

const build = path.resolve(__dirname, './public')
const js = path.resolve(__dirname, './src')

const config = {
  entry: {
    client: js + '/client',
    plugins: js + '/plugins'
  },
  output: {
    path: build + '/js',
    filename: '[name].js'
  },
  module: {
    rules: [
      {
        test: /\.jsx?/,
        loader: 'babel-loader',
        include: js,
        exclude: /node_modules/
      },
      {
        test: /\.scss$/,
        use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      path: build + '/css',
      publicPath: build,
      filename: 'main.css'
    })
  ]
}

module.exports = config
@alexander-akait
Copy link
Member

@jairusd Plugin doesn't have path argument (publicPath also). Please read readme before post issue. Thanks!

@jairusd
Copy link
Author

jairusd commented May 9, 2018

@evilebottnawi

from the docs i read the comment saying: // Options similar to the same options in webpackOptions.output

did i misunderstand that? if so, how can i specify the location of the output?

@alexander-akait
Copy link
Member

@jairusd

new MiniCssExtractPlugin({
  filename: "custom/my/folder/for/css/[name].css",
})

@NithishReddy
Copy link

@evilebottnawi
publicpath will take if we specify on options miniCSSextractPlugin buit its not working
mentioned in https://webpack.js.org/plugins/mini-css-extract-plugin/

@tomatobybike
Copy link

publicpath will take if we specify on options miniCSSextractPlugin buit its not working
mentioned
but it does't work

@mykt0ngc0
Copy link

Here's a workaround by @evilebottnawi :

new MiniCssExtractPlugin({
  filename: "custom/my/folder/for/css/[name].css",
})

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

5 participants