rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.57k stars 568 forks source link

@rollup/plugin-commonjs not resolving commonjs module lilconfig #1673

Closed socketopp closed 4 months ago

socketopp commented 4 months ago

"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "rollup-plugin-postcss": "^4.0.2",

I am using rollup-plugin-postcss to inject css with js so I don't have to do it manually. I am using ES and it's complaining about lilconfig\dist\index.js not supporting ES modules. But I think it's fixed in version 10.0.0 of postcss-cli.

Then I found commonjs and I was thinking it could resolve this issue but it persists.

I will create a replication if necessary in this case.

import svelte from 'rollup-plugin-svelte';
import { terser } from 'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import commonjs from '@rollup/plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import resolve from '@rollup/plugin-node-resolve';

export default {
    input: 'src/main.ts',
    output: {
        sourcemap: true,
        format: 'iife',
        name: 'app',
        file: 'public/build/bundle.min.js',
        plugins: [terser()]
    },
    plugins: [
        commonjs(),
        resolve({
            browser: true,
            dedupe: ['svelte']
        }),
        postcss({
            extensions: ['.css'],
            minimize: true,
            inject: {
                insertAt: 'top'
            }
        }),
        svelte({
            preprocess: sveltePreprocess({
                postcss: true
            }),
        }),
    ],
};