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

Broken in Windows environment #3

Open
born2defy opened this issue Feb 14, 2016 · 6 comments
Open

Broken in Windows environment #3

born2defy opened this issue Feb 14, 2016 · 6 comments

Comments

@born2defy
Copy link

So I am following your instructions on the Readme, but I get an odd error when I run npm start:

pux-example master* $ npm start

> purescript-pux-boilerplate@2.0.0 start C:\Purescript\experiments\pux-example
> gulp watch

[20:44:22] Using gulpfile C:\Purescript\experiments\pux-example\gulpfile.js
[20:44:22] Starting 'clean'...
[20:44:22] Finished 'clean' after 113 ms
[20:44:22] Starting 'watch'...
[20:44:22] [webpack] Building...
[20:44:28] [webpack] Build finished.
Hash: 2ad8de32c52e979028a0
Version: webpack 1.12.13
Time: 5848ms
       Asset    Size  Chunks             Chunk Names
js/bundle.js  660 kB       0  [emitted]  main

ERROR in ./src/purs/Client.purs
Module not found: Error: Cannot resolve module '....outpuundle.js' in C:\Purescript\experiments\pux-example\src\purs
 @ ./src/purs/Client.purs 1:17-50

ERROR in ./src/purs/Server.purs
Module not found: Error: Cannot resolve module '....outpuundle.js' in C:\Purescript\experiments\pux-example\src\purs
 @ ./src/purs/Server.purs 1:17-50

ERROR in ./src/purs/State.purs
Module not found: Error: Cannot resolve module '....outpuundle.js' in C:\Purescript\experiments\pux-example\src\purs
 @ ./src/purs/State.purs 1:17-50

Seems like a file name is getting truncated somewhere, but I don't know enough about this set-up to know where to look. Have you ever seen behavior like this before?

@alexmingoia
Copy link
Owner

Hrm... I'm not able to reproduce those exact errors. Using a fresh clone I was getting an entirely different set of errors I have no seen before. I didn't spend much time to investigate – I suspect this has to do with dependencies not being pinned and purescript 0.8.0. Anyways, I've pushed an update for purescript 0.8.0, and doing a fresh clone npm install then npm start is working for me now. Could you confirm?

@born2defy
Copy link
Author

I will check it out today. For some reason I suspected that it had something to do with how the purescript webpack plugin was creating the output file path on Windows (I am using Windows 7 at the moment). It seems to use path.join under the hood which shouldn't be creating platform issues, but when you look at that truncated name "outpuundle"...

@born2defy
Copy link
Author

Ok, so I cloned the new version and the same issue is still happening. I was able to isolate where the errors are coming from, but I don't know enough about the webpack build process to figure out what is causing them. The last few lines of dist/bundle.js is where the errors are being thrown from. The code is below. The truncating file name doesn't seem to be the cause of the issue, but just a byproduct of the way the error code is written (windows path separator is '\'). Here is the code generated at the bottom of dist/bundle.js:


/* 158 */
/***/ function(module, exports, __webpack_require__) {

  module.exports = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"....output\bundle.js\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()))['Client'];

/***/ },
/* 159 */
/***/ function(module, exports, __webpack_require__) {

  module.exports = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"....output\bundle.js\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()))['Server'];

/***/ },
/* 160 */
/***/ function(module, exports, __webpack_require__) {

  module.exports = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"....output\bundle.js\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()))['State'];

/***/ },
/* 161 */

@alexmingoia
Copy link
Owner

Hrm... it seems the issue is originating from purescript-webpack-plugin, which spawns a child process of psc-bundle and specifies output/bundle.js in the arguments. require('child_process').spawn is a notorious source of cross-platform issues because it's essentially just calling out to the CLI. Looking at the code for purescript-webpack-plugin nothing immediately jumps out at me though.

I have very little Windows experience, so setting up a VM with a Windows 7 development environment will take me some time...

@alexmingoia
Copy link
Owner

On second thought, if it was a problem with spawning the child process the bundle would not finish as it did in the output you pasted above. It could also be an issue with the babel-loader or purs-loader plugins..

@alexmingoia alexmingoia changed the title Strange Webpack Behavior Broken in Windows environment Feb 14, 2016
@born2defy
Copy link
Author

born2defy commented Feb 15, 2016 via email

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