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

psc-bundle: removes require unexpectedly in FFI #1794

Closed
ethul opened this issue Jan 5, 2016 · 0 comments
Closed

psc-bundle: removes require unexpectedly in FFI #1794

ethul opened this issue Jan 5, 2016 · 0 comments
Assignees
Milestone

Comments

@ethul
Copy link

ethul commented Jan 5, 2016

Consider the following setup:

-- A.purs
module A where

foreign import data React :: *

foreign import y :: React
// A.js
// module A

var x = require('react');

function y() {
  return x.react;
}
exports.y = y();
../psc0.8.0-rc.1/purescript/psc -r ../ *.*
../psc0.8.0-rc.1/purescript/psc-bundle -r ../ -m A output/**/*.js
var PS = { };
(function(exports) {


  function y() {
    return x.react;
  }
  exports.y = y();

})(PS["A"] = PS["A"] || {});
(function(exports) {
  // Generated by psc version 0.8.0.0
  "use strict";
  var $foreign = PS["A"];
  exports["y"] = $foreign.y;;

})(PS["A"] = PS["A"] || {});

The statement var x = require('react'); is removed from the output unexpectedly. I hope the above is clear, please let me know if I can provide more information. Note that I get the same behaviour using 0.7.6.1.

@paf31 paf31 added this to the 0.8.0 milestone Jan 10, 2016
@paf31 paf31 self-assigned this Jan 10, 2016
@paf31 paf31 closed this as completed in 70ddf2b Jan 17, 2016
paf31 added a commit that referenced this issue Jan 17, 2016
Fix #1794, preserve external require expressions when minifying
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants