S
S
Swaer2020-01-23 22:52:08
WordPress
Swaer, 2020-01-23 22:52:08

css file not being created why?

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

const conf = {
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, './dist/'),
        filename: 'main.js',
        publicPath: 'dist/',
    },
    
    module: {
        
        rules: [
            {
                test: /\.js$/,
                loader: 'babel-loader',
                // exclude: '/node_modules/'
            },
            {
                test: /\.css$/,
                use: [
                    {
                        loader: MiniCssExtractPlugin.loader,
                        options: {
                            esModule: true,
                        }
                    },
                    'style-loader','css-loader'
                ]
            }
        ]
        
    },
    plugins: [new MiniCssExtractPlugin({
        filename: '[name].css',
        chunkFilename: '[id].css',
    })],
}

module.exports = (env,options) => {
    let production = options.mode === 'production';

    conf.devtool = production ?  'source-map' : 'eval-soursemap'

    return conf
}

Why is the file not being created in dist, the css file is not being created, I ran both dev and prod, what is the problem, it does not give errors when starting

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Mezza, 2019-05-13
@Mezza

Problem solved for Divi theme. The header.php file contains two search forms: the first as a module (I have line 151), the second as a header element (I have line 320). The problem was that I was making changes to the module line. After staging

<input type="hidden" name="post_type" value="product" />
in the header element, the problem was solved.

A
Alex, 2019-04-22
@Kozack

In the theme search file (searchform.php) add

<input type="hidden" name="post_type" value="product">

A
Artem Glod, 2019-04-26
@Vegys

As an option, replace the output of the standard search with a woocommerce search or write a function in the functions.php file

function search_product($query) {
    if ($query->is_search) {
        $query->set('post_type', 'product');
    }
    return $query;
}
add_action('pre_get_posts','search_product');

T
Tooral, 2019-05-01
@Tooral

Tell me, did you manage to solve this problem? Also interested in this question, the same situation.

S
Swaer, 2020-01-24
@Swaer

Suddenly, who needs it, removed 'style-loader' and everything worked, I think that this plugin conflicted with it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question