rollup / rollup-plugin-image

This module has moved and is now available at @rollup/plugin-image / https://github.com/rollup/plugins/blob/master/packages/image
41 stars 13 forks source link

Need exclude/include patterns for file types #6

Closed solidevolution closed 4 years ago

solidevolution commented 7 years ago

There are conflicts while using

together because both try to import an svg:

import svg from './svg/svg.svg

trusktr commented 6 years ago

use exactly that, include and exclude patterns. F.e.

        babel(Object.assign(babelConfig, {
            runtimeHelpers: true,
            exclude: [ 'node_modules/**' ],
            include: [
                'src/**',
                'node_modules/@awaitbox/**'
            ],
        })),
        buble(Object.assign(bubleConfig, {
            exclude: [ 'node_modules/**' ],
            include: [
                'src/**',
                'node_modules/@awaitbox/**'
            ],
        })),
trusktr commented 6 years ago

However, in that example, 'node_modules/@awaitbox/**' won't be included, because the exclude: [ 'node_modules/**' ], is more powerful. Trying to figure out how...

trusktr commented 6 years ago

Look here for options.include and options.exclude: https://github.com/rollup/rollup/wiki/Plugins#conventions

trusktr commented 6 years ago

I tried various sorts of !() patterns, but I couldn't get it to work, so, no update, sorry. I ended up switching to Webpack, it just works in like every case, and is highly maintained.

trusktr commented 6 years ago

Ahah!!!!! After switching to Webpack, I was able to use webpack-rollup-loader to get it to simply work, no more endless (and pointless) fiddling with include/exclude for Rollup plugins.

So my config looks like this: https://github.com/erikdesjardins/webpack-rollup-loader/issues/15#issue-288317827 (just mind that if you use Babel, you might get that error mentioned there, which is easy to fix by injecting a pointless line into the problematic file).

This to me proves that Rollup's resolution of node_modules is just not working. I literally tried everything I could, which spawned me to make this PR which I didn't even actually test because it was too complicated, better just switching to Webpack.

Then I discovered that rollup-loader just works, using Webpack's node module resultion instead!

trusktr commented 6 years ago

Ah, crap, well, Rollup is still giving me problems. Webpack-only it is!

shellscape commented 4 years ago

We're moving this plugin to https://github.com/rollup/plugins where it'll get some TLC. Keep an eye out for this repo being archived and @rollup/plugin-images.