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 output #11

Closed
cdalexndr opened this issue Jul 4, 2019 · 12 comments
Closed

No output #11

cdalexndr opened this issue Jul 4, 2019 · 12 comments

Comments

@cdalexndr
Copy link

Using the following rollup.config:

import {analyze} from 'rollup-plugin-analyzer';
export default {
    input: './first.js',
    output: {
        file: 'bundle.js',
        format: 'iife',
        name: 'bundle'
    },
    plugins: [
        analyze({stdout: true})
    ]
};

Building with the following command doesn't print the analytics information:

> rollup -c .\rollup.config.js

./first.js → bundle.js...
created bundle.js in 31ms

Same results without any options passed to plugin.

@doesdev
Copy link
Owner

doesdev commented Jul 4, 2019

You'll want to use the default import:

import analyze from 'rollup-plugin-analyzer';

That was a change in the 3.0.0 release to be more consistent with other Rollup plugins.

It can still be required destructured, but not used as a named import. So in a node build script you can still use

const { analyze } = require('rollup-plugin-analyzer');

but not

import { analyze } from 'rollup-plugin-analyzer';

@doesdev doesdev closed this as completed Jul 4, 2019
@cdalexndr
Copy link
Author

Same issue with import analyze from 'rollup-plugin-analyzer'.
Note that I am not using a node build script, but running from a terminal.

@doesdev doesdev reopened this Jul 4, 2019
@doesdev
Copy link
Owner

doesdev commented Jul 4, 2019

What Rollup version are you using?

@cdalexndr
Copy link
Author

rollup v1.16.4

@doesdev
Copy link
Owner

doesdev commented Jul 4, 2019

Odd, I'm running 1.16.6 and tried your identical config (with the default import) and it worked as expected. Also updated Rollup in the project and ran all tests against it and all passed.

Are you able to provide a repro gist or repo I could test with?

@cdalexndr
Copy link
Author

cdalexndr commented Jul 4, 2019

https://github.com/cdalexndr/rollup-plugin-analyzer-bug-11

npm install
rollup -c rollup.config.js
./first.js → bundle.js...
created bundle.js in 35ms

@doesdev
Copy link
Owner

doesdev commented Jul 4, 2019

Thanks for the repro. It worked for me on Windows CMD as well as WSL Ubuntu bash shell. I'm not sure what else may be contributing to the failure.

image

@cdalexndr
Copy link
Author

So the problem is in my environment.
These are my global installed npm packages, dunno if they may be conflicting somehow with this plugin:

> npm list -g --depth=0
+-- bower@1.8.2
+-- dependency-cruiser@4.25.0
+-- jscs@3.0.7
+-- npm@6.10.0
+-- rollup@1.16.4
+-- terser@4.0.2
`-- typescript@3.5.2

npm v6.10.0

@cdalexndr
Copy link
Author

The problem was the old node version v6.5.0, updated to v10.16.0 and now it works.

@kevinkace
Copy link

Might be good to add this to the readme.

@doesdev
Copy link
Owner

doesdev commented Sep 12, 2019

Added to the engine's list in the package.json and added a badge for it up top.

@Garfield550
Copy link

No output use rollup 2.3.1 and rollup-plugin-analyzer 3.2.2.

I run rollup command with both PowerShell Core(my login shell) and ZShell(iTerm 2 profile).

Full terminal log:

~/Projects/GitHub/taro-ui [ui-next ≡ +1 ~4 -0 !]> yarn rollup --config ./config/rollup.config.js
yarn run v1.22.4
$ /Users/<Name>/Projects/GitHub/taro-ui/node_modules/.bin/rollup --config ./config/rollup.config.js

/Users/<Name>/Projects/GitHub/taro-ui/src/index.ts → dist/index.js, dist/es/index.js, dist/umd/index.js...
created dist/index.js, dist/es/index.js, dist/umd/index.js in 56.9s
✨  Done in 58.91s.

My rollup.config.js file:

import NodePath from 'path'
import RollupJson from '@rollup/plugin-json'
import RollupNodeResolve from '@rollup/plugin-node-resolve'
import RollupCommonjs from '@rollup/plugin-commonjs'
import RollupTypescript from 'rollup-plugin-typescript2'
import RollupAnalyze from 'rollup-plugin-analyzer'
import Package from '../package.json'

const resolveFile = path => NodePath.resolve(__dirname, '..', path)

const externalPackages = [
  'react',
  'react-dom',
  '@tarojs/components',
  '@tarojs/runtime',
  '@tarojs/taro',
  '@tarojs/react'
]

export default {
  input: resolveFile(Package.source),
  output: [
    {
      file: resolveFile(Package.main),
      format: 'cjs'
    },
    {
      file: resolveFile(Package.module),
      format: 'es'
    },
    {
      file: resolveFile(Package.browser),
      format: 'umd',
      name: 'taro-ui',
      globals: {
        react: 'React',
        '@tarojs/components': 'components',
        '@tarojs/taro': 'Taro'
      }
    }
  ],
  external: externalPackages,
  plugins: [
    RollupJson(),
    RollupNodeResolve({
      customResolveOptions: {
        moduleDirectory: 'node_modules'
      }
    }),
    RollupCommonjs(),
    RollupTypescript({
      tsconfig: resolveFile('tsconfig.build.json')
    }),
    RollupAnalyze({ skipFormatted: true })
  ]
}

System environments:

OS: macOS 10.15.3 (19D76)
PowerShell: 7.0.0
zsh: 5.7.1 (x86_64-apple-darwin19.0)
Node: 13.11.0
npm: 6.13.7
yarn: 1.22.4
rollup: 2.3.1
rollup-plugin-analyzer: 3.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants