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

output dir error #53

Open
asins opened this issue Feb 13, 2017 · 3 comments
Open

output dir error #53

asins opened this issue Feb 13, 2017 · 3 comments

Comments

@asins
Copy link

asins commented Feb 13, 2017

const Path = require('path');
const gulp = require('gulp');
const rollup = require('gulp-rollup');
gulp.task('test', function (cb) {
	// let path = 'test.js';
	let path = 'pc/js/test.js';
	let fullPath = Path.join('~/app/src', path);
	gulp.src(fullPath, {base: '~/app/src'})
		.pipe(rollup({
			allowRealFiles: true,
			entry: fullPath,
			moduleName: 'test',
			format: 'iife'
		}))
		.pipe(gulp.dest(Path.join('~/app', 'build')));
});

if path = 'test.js' then output dir is ~/app/src/test.js,I don't know why.
but if path = 'pc/js/test.js' then output dir is ~/app/pc/js/test.js, this is right.

so change operandom/gulp-rollup all is ok. And I think it is necessary to use 'entry' as' gulp.src'.

@lemmabit
Copy link
Collaborator

operandom/gulp-rollup is just an outdated gulp-rollup. gulp-rollup v1.x has been superseded by rollup-stream, so you should be using that instead.

With that being said, running your test case just gives me this:

$ gulp test
[06:33:46] Using gulpfile /tmp/test-case/gulpfile.js
[06:33:46] Starting 'test'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Could not resolve entry (~/app/src/pc/js/test.js)
    at error (/tmp/test-case/node_modules/rollup/dist/rollup.js:170:12)
    at /tmp/test-case/node_modules/rollup/dist/rollup.js:9284:5
    at process._tickCallback (internal/process/next_tick.js:103:7)

I would also prefer a test case that doesn't require me to put things in my home directory if you can produce one. Although once again, my recommendation is to simply use rollup-stream, which is far, far less prone to problems like this one.

@asins
Copy link
Author

asins commented Feb 14, 2017

you test case error is ~/app/src/pc/js/test.js file does not exist.
In my Mac computer is actually written like this: /Users/asins/app/src/pc/js/test.js.

You said that you can use rollup-stream, but it is not convenient for me, because I have a number of entry documents coexist, and the output is a number of files, want to be placed in a gulp processing stream.

@lemmabit
Copy link
Collaborator

It does exist. That's why I asked you not to make me put things in my home directory if possible. I'm using Linux, which shouldn't be any different, but perhaps it is. Regardless, if you can eliminate the ~ in the path while still producing incorrect results, that will help.

I guess I forgot to put information about how to achieve multiple entry points in the README. Sorry about that. In the meantime, this comment will help: lemmabit/rollup-stream#9 (comment)

Its rather boilerplate, I'll admit. I've never had sufficient motivation to create a separate package to do that work. I'd say it's definitely a step up from using gulp-rollup for this, though.

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

2 participants