Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 03:43
    webpack-bot labeled #10097
  • 03:42
    webpack-bot labeled #10097
  • 03:26
    webpack-bot labeled #10097
  • 03:26
    Lyrkan opened #10097
  • Dec 07 17:28
    spamshaker review_requested #10044
  • Dec 07 17:28
    spamshaker synchronize #10044
  • Dec 07 15:41
    webpack-bot unlabeled #10044
  • Dec 07 15:41
    webpack-bot labeled #10044
  • Dec 07 15:41
    spamshaker synchronize #10044
  • Dec 07 00:51
    webpack-bot unlabeled #10080
  • Dec 07 00:51
    webpack-bot labeled #10080
  • Dec 07 00:44
    sokra edited #10080
  • Dec 07 00:36
    sokra synchronize #10080
  • Dec 07 00:36

    sokra on cjs-tree-shaking

    fix test case (compare)

  • Dec 07 00:08
    sokra synchronize #10080
  • Dec 07 00:08

    sokra on cjs-tree-shaking

    use parser state instead of mod… (compare)

  • Dec 06 14:31
    webpack-bot synchronize #7075
  • Dec 06 14:30

    webpack-bot on npm_and_yarn

    (compare)

  • Dec 06 14:30

    webpack-bot on master

    chore(deps-dev): bump @babel/co… Merge pull request #10092 from … (compare)

  • Dec 06 14:30
    webpack-bot closed #10092
Anon Ymous
@burnt.orange.cap_gitlab
I am new to webpack (and JS, haven't really worked on the frontend before)
March Works
@MarchWorks

I would like to send build progress to browser (through webpack-dev-middleware to eventSource) but I don't know how

compiler.apply(new webpack.ProgressPlugin(function(percentage, msg) {

}));
const devMiddleware = require('webpack-dev-middleware')(compiler, {
   logLevel: 'silent',
   publicPath: '/somePath/'
})

in the browser

const sse = new EventSource('/somePath/') // not sure what I should put here
sse.addEventListener('message', event => onSseMessage(event))
Tiago Martinho
@tiagosmartinho

hello,

I am trying to load the fonts through vue.config.js. However I am not getting it.

scss

@include font-face(Lato, '/fonts/lato/latoThin', 100, normal, eot woff2 woff svg ttf);

vue.config.js

     ....
     rules: [{
                test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
                use: [{
                    loader: 'file-loader',

                    options: {
                        name: 'lato/[name].[ext]',
                        outputPath: 'fonts/'
                    }
                }]
            },

if I remove the first slash from the source path, fonts/lato/latoThin it loads the fonts, but in compile this error appears

* ./fonts/lato/latoThin.eot? in ./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-3-1!./node_modules/postcss-loader/src??ref--8-oneOf-3-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-3-3!./node_module s/resolve-url-loader!./src/styles/global.scss

and put the bar back in the font path and it works - /fonts/lato/latoThin

Any solution?

Gregory Danko
@g-style
@johnmarinelli I have found a solution. Actually there is an option for this: output.chunkFilename. So I set it to [name].[chunkhash].js and it works like a charm. Thank you anyway :)
Rob
@rm-rf-etc
@johnmarinelli thanks, that helped a bit. I have a better sense of the problem now but I'm not sure why this is happening. When I try to run a build process that isolates what I'm trying to build, it seems that webpack tries to import files that don't exist and I didn't ask it to import. Here's the error output.
ERROR in Entry module not found: Error: Can't resolve './src' in '/Users/rchristian/Company/assets'
resolve './src' in '/Users/rchristian/Company/assets'
    using description file: /Users/rchristian/Company/assets/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/rchristian/Company/assets/package.json (relative path: ./src)
        no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/rchristian/Company/assets/src is not a file
        .wasm
        Field 'browser' doesn't contain a valid alias configuration
        /Users/rchristian/Company/assets/src.wasm doesn't exist
        .mjs
        Field 'browser' doesn't contain a valid alias configuration
        /Users/rchristian/Company/assets/src.mjs doesn't exist
        .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/rchristian/Company/assets/src.js doesn't exist
        .json
        Field 'browser' doesn't contain a valid alias configuration
        /Users/rchristian/Company/assets/src.json doesn't exist
        as directory
        existing directory
            using path: /Users/rchristian/Company/assets/src/index
            using description file: /Users/rchristian/Company/assets/package.json (relative path: ./src/index)
                no extension
                Field 'browser' doesn't contain a valid alias configuration
                /Users/rchristian/Company/assets/src/index doesn't exist
                .wasm
                Field 'browser' doesn't contain a valid alias configuration
                /Users/rchristian/Company/assets/src/index.wasm doesn't exist
                .mjs
                Field 'browser' doesn't contain a valid alias configuration
                /Users/rchristian/Company/assets/src/index.mjs doesn't exist
                .js
                Field 'browser' doesn't contain a valid alias configuration
                /Users/rchristian/Company/assets/src/index.js doesn't exist
                .json
                Field 'browser' doesn't contain a valid alias configuration
                /Users/rchristian/Company/assets/src/index.json doesn't exist
{
    mode: 'production',
    module: {
        rules: [{
            test: /\.s[ac]ss$/i,
            use: ['sass-loader'],
        }],
    },
}
ivan-vilches
@ivan-vilches
hello folks
i am looking for the chats for webpack community , is this active?
Rob
@rm-rf-etc
Why would sass-loader output a main.js file?
{
    mode: 'production',
    entry: [
        path.join(__dirname, './src/stylesheets/postcss.scss'),
        path.join(__dirname, './src/stylesheets/google_fonts.scss'),
    ],
    output: {
        path: path.join(__dirname, './dist/stylesheets'),
        publicPath: './dist/stylesheets',
    },
    plugins: [
        new CopyPlugin([{
            from: 'src/images/',
            to: path.join(__dirname, './dist/images/'),
        }, {
            from: 'src/fonts/',
            to: path.join(__dirname, './dist/fonts/'),
        }]),
    ],
    module: {
        rules: [{
            test: /\.s[ac]ss$/i,
            use: [
                'css-loader',
                'sass-loader',
            ],
        }],
    },
}
dist/stylesheets/main.js -> contents look like minified CSS
Rob
@rm-rf-etc
So, after adding filename: 'styles.css',, the file is suddenly readable (indented correctly), and I can see webpack bundler code, plus stuff...
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(0)(false);
// Module
exports.push([module.i, "/*!\n *  Font Awesome 4.4.0 by @davegandy ...
How do I get sass to compile to a regular css file?
Rob
@rm-rf-etc
Found something. "It is not trivial to compile an SCSS file with Webpack, which is not included in the JS file, into its own CSS file. This post shows you how to do that." https://florianbrinkmann.com/en/sass-webpack-4240/
Obviously it should be trivial
Charles Guo
@CharlesGC
hello
Egor Baranov
@goganchic

Hello!

I'm exploring source codes of webpack and mini-css-extract-plugin and I have a question: why two different structures Dependency and Module were introduced? Why Module structure is not enough? If I'm not mistaken Dependency has only information about what should be built and Module has all algorithms about building, caching and so on. Am I correct? In this case in mini-css-extract-plugin CssDependency looks a bit strange, because it does all receives prepared contents from loader and CssModule only exposes prebuilt sources.

harshit786
@harshit786
Hello we are getting problem while running webpack
The changes in the src folder of main.scss
we are changing but nothing reflects
please help us out
Here at stack also we have added the problem
harshit786
@harshit786
Could you provide the path where the files are running ?
Is there anybody?
harshit786
@harshit786
Please reply anybody I am stucking from three days
harshit786
@harshit786
😞
Rogan Louwrens
@hallucinarium
@harshit786 Have you tried importing into index.js (or whatever your entry point is)?
One of my CSS imports via webpack is into index.js is import "./assets/css/base.css";
Tiago Martinho
@tiagosmartinho

hello,

I am trying to load the fonts through vue.config.js. However I am not getting it.

scss

@include font-face(Lato, '/fonts/lato/latoThin', 100, normal, eot woff2 woff svg ttf);

vue.config.js

     ....
     rules: [{
                test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
                use: [{
                    loader: 'file-loader',

                    options: {
                        name: 'lato/[name].[ext]',
                        outputPath: 'fonts/'
                    }
                }]
            },

if I remove the first slash from the source path, fonts/lato/latoThin it loads the fonts, but in compile this error appears

* ./fonts/lato/latoThin.eot? in ./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-3-1!./node_modules/postcss-loader/src??ref--8-oneOf-3-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-3-3!./node_module s/resolve-url-loader!./src/styles/global.scss

and put the bar back in the font path and it works - /fonts/lato/latoThin

Any solution?

Rogan Louwrens
@hallucinarium
Have you tried using the url-loader?
Alternatively, try './fonts/lato/latoThin'
Tiago Martinho
@tiagosmartinho

Alternatively, try './fonts/lato/latoThin'

already tried this way

Have you tried using the url-loader?

Not yet, I'll try

harshit786
@harshit786

Encore.addStyleEntry('styles.min', './src/css/main.scss');

/**
 * JavaScript Entry Point
 */
Encore.addEntry('main.min', './src/js/main.js');

@ Rogan

these two files
Rogan Louwrens
@hallucinarium
@harshit786 Which framework are you using?
harshit786
@harshit786
This is simple
html files
webpack is running through scripts package.json
Here at stack also we have added the problem
even after deleting main.scss
still it is loading on web browser
Rogan Louwrens
@hallucinarium
Hmm, I haven't used webpack-encore before.
Can you try doing an ES6-style import of your stylesheets in your main JS file?
John Marinelli
@johnmarinelli
@rm-rf-etc i would also consider splitting the rule into 2 separate rules; so test for css and sass files and use different loaders independently, instead of checking for both using a regex and using both loaders
i've seen problems when using multiple loaders on 1 file
harshit786
@harshit786
@hallucinarium could you provide an example