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

Error : "Expecting single root statement in program"? #7

Closed
zabojad opened this issue Sep 14, 2017 · 13 comments · Fixed by #9
Closed

Error : "Expecting single root statement in program"? #7

zabojad opened this issue Sep 14, 2017 · 13 comments · Fixed by #9

Comments

@zabojad
Copy link

zabojad commented Sep 14, 2017

Hi!

I'm trying the haxe-loader for the first time. I am facing the below issue when trying to run my project in webpack-dev-server. Any idea why?

$ node_modules/webpack/bin/webpack.js --config webpack.config.dev.js
haxe -D webpack_namespace=build-web -main myproj.Boot -js /var/folders/mc/2kyt0cbn12d95zcg5wzb0sj80000gn/T/tmp-56505G9un2hNdyd9X.js -cp src -lib js-kit -lib haxe-loader -lib react -lib react-addons -debug

/Users/thomas/wksp_myproj/myproj/node_modules/haxe-modular/tool/bin/split.js:400
				throw new js__$Boot_HaxeError("Expecting single root statement in program");
				^
Error: Expecting single root statement in program
    at Object.walkProgram (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-modular/tool/bin/split.js:400:11)
    at Object.processInput (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-modular/tool/bin/split.js:335:8)
    at Object.Parser (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-modular/tool/bin/split.js:325:7)
    at Object.Main.run.$hx_exports.run [as run] (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-modular/tool/bin/split.js:311:15)
    at processOutput (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-loader/index.js:68:27)
    at exec (/Users/thomas/wksp_myproj/myproj/node_modules/haxe-loader/index.js:46:27)
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
@zabojad
Copy link
Author

zabojad commented Sep 14, 2017

If I comment the lines 400 -> 402 in node_modules/haxe-modular/tool/bin/split.js, it works. But I'm not sure what those lines were supposed to do...

else {
    throw new js__$Boot_HaxeError("Expecting single root statement in program");
}

@jasononeil
Copy link
Owner

@elsassph do you want to comment on this? (@zabojad, so you know split.js comes from the haxe-modular repo and Philippe knows much more about that then I do!)

Could you also post the hxml file you're using?

@zabojad
Copy link
Author

zabojad commented Sep 15, 2017

Hi there !

My hxml is pretty much standard:

-main myproj.Boot
-js app/myproj.js
-cp src
-lib js-kit
-lib haxe-loader
-lib react
-lib react-addons
-debug

@elsassph
Copy link
Collaborator

What version Haxe are you using?

@zabojad
Copy link
Author

zabojad commented Sep 15, 2017

$ haxe -v
Haxe Compiler 3.4.2 - (C)2005-2017 Haxe Foundation

I can't install the 3.4.3 yet because of

@elsassph
Copy link
Collaborator

Can you share a sample project?

@elsassph
Copy link
Collaborator

elsassph commented Oct 2, 2017

This is fixed in haxe-modular now, requires an update of the modular dependency to 0.6.0 in haxe-loader: elsassph/haxe-modular#27

@zabojad
Copy link
Author

zabojad commented Oct 3, 2017

Nice, thank you Philippe! Sorry for not having answered earlier...

@elsassph
Copy link
Collaborator

elsassph commented Oct 3, 2017

I hope that's the solution for you though...

@zabojad
Copy link
Author

zabojad commented Oct 3, 2017

I'll come back to it at the end of this week and confirm weither it's fixed or not after having updated haxe-modular. By the way, how should I do this? If haxe-modular is already installed for my project, then haxe-loader will use it or will it install its own version of haxe-modular?

@elsassph
Copy link
Collaborator

elsassph commented Oct 3, 2017

You can point on my fork of haxe-loader to try it

@jasononeil
Copy link
Owner

@zabojad this is now released as haxe-loader@0.4.1

@zabojad
Copy link
Author

zabojad commented Oct 24, 2017

@jasononeil @elsassph just for your information, the issue doesn't show up anymore with haxe-loader@0.4.1

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

Successfully merging a pull request may close this issue.

3 participants