wessberg / rollup-plugin-ts

A TypeScript Rollup plugin that bundles declarations, respects Browserslists, and enables seamless integration with transpilers such as babel and swc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Github Action: unknown field `cwd`

bruceharrison1984 opened this issue · comments

  • Version: 3.0.2
  • Rollup Version: 2.79.0
  • Operating System and version (if applicable): Windows 10
  • Node Version (if applicable): 16.x
  • Turborepo: 1.5.5

Expected Behavior

The build result should match what happens locally.

Actual Behavior

Running a build on Github Actions via Turborepo throws the following error:

schedulely:rollup: cache miss, executing cb6b33447a5e1d2b
schedulely:rollup: 
schedulely:rollup: > schedulely@0.0.31 rollup
schedulely:rollup: > rollup -c
schedulely:rollup: 
schedulely:rollup: 
schedulely:rollup: src/index.ts → dist...
schedulely:rollup: [!] (plugin Typescript) Error: failed to parse options
schedulely:rollup: 
schedulely:rollup: Caused by:
schedulely:rollup:     unknown field `cwd` at line 1 column 521
schedulely:rollup: src/index.ts
schedulely:rollup: Error: failed to parse options
schedulely:rollup: 
schedulely:rollup: Caused by:
schedulely:rollup:     unknown field `cwd` at line 1 column 521
schedulely:rollup:     at error (/home/runner/work/react-pico-calendar/react-pico-calendar/node_modules/rollup/dist/shared/rollup.js:198:30)
schedulely:rollup:     at throwPluginError (/home/runner/work/react-pico-calendar/react-pico-calendar/node_modules/rollup/dist/shared/rollup.js:21718:12)
schedulely:rollup:     at /home/runner/work/react-pico-calendar/react-pico-calendar/node_modules/rollup/dist/shared/rollup.js:2[29](https://github.com/bruceharrison1984/react-pico-calendar/actions/runs/3177008468/jobs/5176958416#step:7:29)05:20
schedulely:rollup:     at transform (/home/runner/work/react-pico-calendar/react-pico-calendar/node_modules/rollup/dist/shared/rollup.js:21865:16)
schedulely:rollup:     at ModuleLoader.addModuleSource (/home/runner/work/react-pico-calendar/react-pico-calendar/node_modules/rollup/dist/shared/rollup.js:22090:[30](https://github.com/bruceharrison1984/react-pico-calendar/actions/runs/3177008468/jobs/5176958416#step:7:30))
schedulely:rollup: 
schedulely:rollup: npm ERR! Lifecycle script `rollup` failed with error: 
schedulely:rollup: npm ERR! Error: command failed 
schedulely:rollup: npm ERR!   in workspace: schedulely@0.0.[31](https://github.com/bruceharrison1984/react-pico-calendar/actions/runs/3177008468/jobs/5176958416#step:7:31) 
schedulely:rollup: npm ERR!   at location: /home/runner/work/react-pico-calendar/react-pico-calendar/packages/Schedulely 
schedulely:rollup: ERROR: command finished with error: command (/home/runner/work/react-pico-calendar/react-pico-calendar/packages/Schedulely) npm run rollup exited (1)

This only occurs when running out of a Github action, local builds seems to pass just fine.

config

import { defineConfig } from 'rollup';
import inject from '@rollup/plugin-inject';
import postcss from 'rollup-plugin-postcss';
import ts from 'rollup-plugin-ts';

const options = defineConfig({
  input: 'src/index.ts',
  output: {
    sourcemap: 'hidden',
    dir: 'dist',
    format: 'esm',
    assetFileNames: '[name].css',
  },
  external: ['react', 'react-dom'],
  plugins: [
    postcss({ extract: 'index.css', sourceMap: true }),
    ts({
      transpiler: 'swc',
      swcConfig: {
        jsc: {
          minify: {
            compress: true,
            mangle: true,
          },
        },
        minify: true,
      },
    }),
    inject({
      React: 'react',
    }),
  ],
});

export default options;

This appears to have been a transient issue with Github. After a few hours of fighting with this, suddenly the build started passing again.