Skip to content
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

Generated file missing in the manifest #14

Open
redayoub opened this issue Oct 31, 2017 · 9 comments
Open

Generated file missing in the manifest #14

redayoub opened this issue Oct 31, 2017 · 9 comments

Comments

@redayoub
Copy link

I'm using this plugin with webpack-manifest-plugin, but the generated rtl files are missing in the manifest.json file, is there any way to add them automatically ? also Is there a way to use rtl-css-loader with sass files, I tried to to that but it fails.

@redayoub
Copy link
Author

redayoub commented Nov 3, 2017

up

@JakeHenshall
Copy link

JakeHenshall commented Nov 5, 2017

Adding this to the manifest would be great.

@redayoub
Copy link
Author

up

2 similar comments
@redayoub
Copy link
Author

up

@redayoub
Copy link
Author

redayoub commented Dec 4, 2017

up

@romainberger
Copy link
Owner

Hi, can you show me your webpack configuration so I can test it? Thanks

@redayoub
Copy link
Author

redayoub commented Dec 8, 2017

sure.

import path from 'path'
import webpack from 'webpack'
import ManifestPlugin from 'webpack-manifest-plugin'
import UglifyJSPlugin from 'uglifyjs-webpack-plugin'
import CleanWebpackPlugin from 'clean-webpack-plugin'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import WebpackRTLPlugin from 'webpack-rtl-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin'

const dev = process.env.NODE_ENV === 'dev'

let cssLoaders = [{
    loader: 'css-loader', 
    options: {
        importLoaders: 1,
        minimize: !dev
    }
}]

let config = {
    entry: {
        app: ['./assets/css/app/app.scss', './assets/js/app/app.js']
    },  

    output: {
        path: path.resolve(__dirname, 'web/assets'),
        filename: dev ? 'js/[name].js' : 'js/[name].[chunkhash:8].js',
        publicPath: (dev ? 'https://127.0.0.1:8123' : '') + '/assets/'
    },

    devtool: dev ? 'cheap-module-eval-source-map' : false,

    devServer: {
        contentBase: path.resolve(__dirname, 'web'),
        host: '127.0.0.1',
        port: 8123,
        overlay: true,
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
            'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
        },
        stats: {
            colors: true
        }
    },

    module: {
        rules: [
            {
                test: /\.css$/,
                use: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    use: cssLoaders
                })
            },
            { 
                test: /\.scss$/, 
                use: ExtractTextPlugin.extract({ 
                    fallback: 'style-loader', 
                    use: [...cssLoaders, 'sass-loader']
                })
            },
            {
                test: /\.(png|jpg|jpeg|gif)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: 'images/[name].[hash:8].[ext]'
                        }  
                    }
                ]
            },
            {
                test: /\.(eot|svg|ttf|woff|woff2)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: 'fonts/[name].[hash:8].[ext]'
                        }  
                    }
                ]
            }
        ]
    },

    plugins: [
        new ExtractTextPlugin({
            filename: dev ? 'css/[name].css' : 'css/[name].[contenthash:8].css',
            disable: dev
        })
    ]
};

if (!dev) {
    config.plugins.push(new CleanWebpackPlugin([path.resolve(__dirname, 'web/assets/')]));
    config.plugins.push(new UglifyJSPlugin());
    config.plugins.push(new ManifestPlugin());
    config.plugins.push(new WebpackRTLPlugin());
}

export default config;

@peterfirst
Copy link

An immediate solution would be to add the ManifestPlugin after the WebpackRTLPlugin.

new WebpackRTLPlugin(),
new ManifestPlugin({
  fileName: 'manifest.json',
  map: (file) => {
    if (/\.rtl\.css$/.test(file.path)) {
      file.name = file.name.replace('.css', '.rtl.css');
    }
    return file;
  },
}),`

`

@vrushank
Copy link

Hi, can you show me your webpack configuration so I can test it? Thanks

Any update on this? It will be a really great feature if it can be added in manifest.

Thanks.

atimmer added a commit to atimmer/webpack-helpers that referenced this issue Apr 6, 2021
When using the WebpackRTLPlugin the manifest doesn't produce entries
for both the original and the RTL file. This results in the wrong file
being loaded. This is caused by the fact that both files are in the
same chunk.

There is an issue tracking this on the WebpackRTLPlugin:
romainberger/webpack-rtl-plugin#14

This commit includes a workaround. By providing a `map` function to
the manifest plugin we can change the name when we're dealing with an
RTL file. That results in two entries in the eventual manifest.
atimmer added a commit to atimmer/webpack-helpers that referenced this issue Apr 6, 2021
When using the WebpackRTLPlugin the manifest doesn't produce entries
for both the original and the RTL file. This results in the wrong file
being loaded. This is caused by the fact that both files are in the
same chunk.

There is an issue tracking this on the WebpackRTLPlugin:
romainberger/webpack-rtl-plugin#14

This commit includes a workaround. By providing a `map` function to
the manifest plugin we can change the name when we're dealing with an
RTL file. That results in two entries in the eventual manifest.
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