Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No valid exports main found for" @rollup/pluginutils #230

Closed
vigle opened this issue Jun 9, 2020 · 2 comments
Closed

"No valid exports main found for" @rollup/pluginutils #230

vigle opened this issue Jun 9, 2020 · 2 comments
Labels
kind: support Asking for support with something or a specific use case scope: upstream Issue in upstream dependency solution: out-of-scope This is out of scope for this project solution: workaround available There is a workaround available for this issue

Comments

@vigle
Copy link

vigle commented Jun 9, 2020

What happens and why it is wrong

Environment

[!] Error: No valid exports main found for '/Users/jiaxunwei/myCode/my-story/node_modules/@rollup/pluginutils'
Error: No valid exports main found for '/Users/jiaxunwei/myCode/my-story/node_modules/@rollup/pluginutils'
    at resolveExportsTarget (internal/modules/cjs/loader.js:611:9)
    at applyExports (internal/modules/cjs/loader.js:492:14)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:643:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:941:27)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at Object.<anonymous> (/Users/jiaxunwei/myCode/my-story/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:15:19)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)

Versions

  • typescript:3.9.5
  • rollup:2.15.0
  • rollup-plugin-typescript2: 0.27.1

rollup.config.js

import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from 'rollup-plugin-babel';
import postcss from 'rollup-plugin-postcss';

import pkg from './package.json';

export default {
  input: 'src/index.tsx',
  output: [
    {
      file: pkg.main,
      format: 'cjs',
      sourcemap: true
    },
    {
      file: pkg.module,
      format: 'es',
      sourcemap: true
    }
  ],
  plugins: [
    postcss({
      extract: false,
      modules: true,
    }),
    typescript({
      declaration: true,
    }),
    resolve(),
    commonjs({ include: /node_modules/ }),
    babel({ 
      exclude: "node_modules/**"
    }),
  ],
  external: [
    ...Object.keys(pkg.dependencies || {}),
    ...Object.keys(pkg.peerDependencies || {})
  ]
}

tsconfig.json

{
    "compilerOptions": {
      "outDir": "build/lib",
      "module": "commonjs",
      "target": "es5",
      "lib": ["es5", "es6", "es7", "es2017", "dom"],
      "sourceMap": true,
      "allowJs": true,
      "jsx": "react",
      "moduleResolution": "node",
      "rootDirs": ["src"],
      "baseUrl": "src",
      "forceConsistentCasingInFileNames": true,
      "noImplicitReturns": true,
      "noImplicitThis": true,
      "noImplicitAny": true,
      "strictNullChecks": true,
      "suppressImplicitAnyIndexErrors": true,
      "noUnusedLocals": true,
      "declaration": true,
      "esModuleInterop": true,
      "allowSyntheticDefaultImports": true,
      "experimentalDecorators": true,
      "emitDecoratorMetadata": true,
      
    },
    "include": ["src/**/*.tsx"],
    "exclude": ["node_modules", "build", "scripts"]
  }

package.json

{
  "name": "my-story",
  "version": "1.0.0",
  "description": "",
  "main": "dist/index.js",
  "module": "dist/index.es.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "build-rollup": "rollup -c"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {},
  "devDependencies": {
    "@babel/core": "^7.10.2",
    "@babel/preset-typescript": "^7.10.1",
    "@rollup/plugin-commonjs": "^13.0.0",
    "@rollup/plugin-node-resolve": "^8.0.1",
    "@rollup/plugin-typescript": "^4.1.2",
    "@storybook/addon-actions": "^5.3.19",
    "@storybook/addon-info": "^5.3.19",
    "@storybook/addon-links": "^5.3.19",
    "@storybook/addons": "^5.3.19",
    "@storybook/react": "^5.3.19",
    "babel-loader": "^8.1.0",
    "babel-preset-react-app": "^9.1.2",
    "react-docgen-typescript-loader": "^3.7.2",
    "rollup": "^2.15.0",
    "rollup-plugin-babel": "^4.4.0",
    "rollup-plugin-postcss": "^3.1.2",
    "rollup-plugin-typescript2": "^0.27.1",
    "ts-loader": "^7.0.5",
    "typescript": "^3.9.3"
  }
}

plugin output with verbosity 3

@sami616

This comment was marked as spam.

@agilgur5
Copy link
Collaborator

agilgur5 commented Jul 18, 2020

Per your error log, this is an upstream error in @rollup/pluginutils. Can also see related comments in jaredpalmer/tsdx#747 (comment), pointing to rollup/plugins#473, which says to upgrade Node as the 13.x line (mostly v13.0-13.7) has bugs with conditional exports

@agilgur5 agilgur5 added scope: upstream Issue in upstream dependency kind: support Asking for support with something or a specific use case labels Apr 24, 2022
@agilgur5 agilgur5 changed the title bug "No valid exports main found for" @rollup/pluginutils Apr 24, 2022
@agilgur5 agilgur5 added the solution: workaround available There is a workaround available for this issue label Apr 24, 2022
Repository owner locked as resolved and limited conversation to collaborators Apr 24, 2022
@agilgur5 agilgur5 added the solution: out-of-scope This is out of scope for this project label Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: support Asking for support with something or a specific use case scope: upstream Issue in upstream dependency solution: out-of-scope This is out of scope for this project solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

No branches or pull requests

4 participants