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

Platform dependant files sould be able to live without root files #1

Open
Heliodromel opened this issue Jun 8, 2015 · 3 comments
Open

Comments

@Heliodromel
Copy link
Collaborator

Let's say that i have only three files in my project :

  • test-ios-prod.js
  • test-prod.js
  • TestApi.js

The two first files are doing the job, the last one is only an api for external modules. Only the last file is exposed to the world. In TestApi.js, i have something like :

var test = require("./test.js");

The test.js file doesn't exist in my project, i only have specifics. Indeed, my dimensions are :

  • prod, test and dev
  • ios and android

Now, if i build the project with browserify, i will get an error :

gulp.task("withBrowserify", ["clean"], function() {
    return browserify({
        entries: paths.entryPoint
    })
    .transform(platformify
              .filter(["prod", "dev", "test"]))
              .filter(["ios", "android"])
    .bundle()
    .pipe(source(paths.outputFile))
    .pipe(gulp.dest(paths.build));
});
events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: Cannot find module './test.js' from '../gulp-plateform-file/test/files'

This library should be able to handle specific files with no root file.

@Heliodromel
Copy link
Collaborator Author

We should probably use the browserify tools to create a require transform so that we could analyze the require and change the imports before they are actually done by browserify

@jruchaud
Copy link
Owner

It is fixed for the gulp task. Now we process the specific file even if you don't have the base file without tokens.

@Heliodromel
Copy link
Collaborator Author

A babel plugin has been created to handle this when working with babel + browserify or babel alone. There is no support though for browserify only.

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