Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Breaks on webpack 1.13.1 #95

Closed
dmitriid opened this issue Jun 16, 2016 · 6 comments
Closed

Breaks on webpack 1.13.1 #95

dmitriid opened this issue Jun 16, 2016 · 6 comments
Labels

Comments

@dmitriid
Copy link

dmitriid commented Jun 16, 2016

tl;dr Having plugin enabled breaks webpack builds somwhere in webpack-core/lib/ConcatSource.js

> npm install --save-dev webpack

This installs webpack 1.13.1

Given the following webpack.config:

var SvgStore = require('webpack-svgstore-plugin');

var config = {
    entry:   {
        app: [
            '/soma-file.js'
        ],
        lib: [
            'lodash'
        ]
    },
    output:  {
        path:              '/path',
        filename:          filename
    },
    module:  {
        loaders: [
            {
                test:   /\.js$/,
                loader: 'babel',
                query:  {
                    presets: ['es2015', 'stage-0', 'react'],
                    compact: false
                }
            },
            {
                test:   /\.json$/,
                loader: 'json'
            }
        ]
    },
    plugins: [
        new SvgStore(path.join('./img/svg', '', '**!/!*.svg'), path.join('./', ''), {
            name:        '[hash].sprite.svg',
            chunk:       'app',
            prefix:      'pref-',
            baseUrl:     '/my-url',
            svgoOptions: {}
        }),
        new webpack.optimize.CommonsChunkPlugin("lib", "lib.js", Infinity)
    ],
    bail:    false,
    target:  'web'
};

Trying to run this results in:

/node_modules/webpack-core/lib/ConcatSource.js:24
        return typeof item === "string" ? item : item.source();
                                                     ^

TypeError: Cannot read property 'source' of undefined
    at /node_modules/webpack-core/lib/ConcatSource.js:24:48
    at Array.map (native)
    at ConcatSource.source (/node_modules/webpack-core/lib/ConcatSource.js:23:23)
    at Compiler.writeOut (/node_modules/webpack/lib/Compiler.js:256:26)
    at Compiler.<anonymous> (/node_modules/webpack/lib/Compiler.js:246:20)
    at /node_modules/async/lib/async.js:181:20
    at Object.async.forEachOf.async.eachOf (/node_modules/async/lib/async.js:233:13)
    at Object.async.forEach.async.each (/node_modules/async/lib/async.js:209:22)
    at Compiler.emitFiles (/node_modules/webpack/lib/Compiler.js:235:20)
    at /node_modules/mkdirp/index.js:48:26
    at FSReqWrap.oncomplete (fs.js:82:15)

Will report this to webpack as well, could be a problem on their side: see webpack/core#24

@soluml
Copy link

soluml commented Jun 16, 2016

Ok.. man.. I've been banging my head on this issue thinking it was something in my setup. I'm definitely experiencing this as well on 1.13.1.

The issue only occurs when I set the chunk value. If I leave the chunk value blank, the error doesn't occur, but the SVG does not build.

I'm also using the CommonsChunkPlugin as in the example above.

@mrsum
Copy link
Owner

mrsum commented Jun 20, 2016

Hi! Can you look, this version 3.0.0-alpha.1?
code here https://github.com/mrsum/webpack-svgstore-plugin/tree/feature/refactor

I rebuild main idea.

@dmitriid
Copy link
Author

Same problem, sadly :(

@mrsum
Copy link
Owner

mrsum commented Jun 20, 2016

@dmitriid do you red readme for this version?

@dmitriid
Copy link
Author

@mrsum What are the differences?

The only difference I see is

put function mark at your chunk

which, honestly, I have no idea what it means :)

@mrsum
Copy link
Owner

mrsum commented Jun 24, 2016

@dmitriid try 3.0.0-alpha.2 version
documentation here https://github.com/mrsum/webpack-svgstore-plugin/blob/feature/refactor/README.md

@mrsum mrsum added the bug label Jun 24, 2016
@mrsum mrsum closed this as completed Aug 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants