2014-11-18 1 views
0

prelude-ls 프로젝트처럼 내 LiveScript 프로젝트를 모듈화해야합니다.브라우저에서 LiveScript의 "require 'mymodule'"이 작동하지 않습니다.

여기 내 test project입니다 :

실행 서버 코드 :

$ lsc server.ls 

당신은 적절한 출력이 표시됩니다 Readme.md에서

git clone https://bitbucket.org/ceremcem/livescript-module-test 

내가 문제를 재현하는 단계를 포함.

실행 클라이언트 코드 : 오류가 표시됩니다

$ lsc -c myapp.ls 
    $ lsc -c mymodule.ls 
    $ browserify -r ./mymodule.js > mymodule-browser.js 
    $ firefox index.html 

열기 불을 지르고 다음, 여기 loganfsmyth의 도움으로 서곡 - LS 프로젝트 조금 더 깊이를 검사 한 후

Error: Cannot find module './mymodule' 

    ...eturn a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");... 
+1

'browserify -t browserify-livescript -r./mymodule.ls'? – loganfsmyth

+0

아쉽게도 작동하지 않습니다. 테스트 프로젝트의 소스 코드를 포함하도록 내 질문을 편집했습니다. 어쩌면 당신은 그것을보고 싶을 것입니다. – ceremcem

+0

그것은'-r' 옵션으로 해결되었지만 이상하게 보입니다. – ceremcem

답변

0

을하고 the example code입니다 및 here is the receipt을 사용하여 모듈의 브라우저 버전을 구축하십시오.

Run server code:

$ lsc server.ls 

You will see the proper output:

this is server script, running with lsc 
my test function has been called 

Run client code:

$ lsc -c myapp.ls 
$ lsc -c mymodule.ls 
$ browserify -r ./mymodule.js:mymodule > mymodule-browser.js 
$ firefox index.html 

Open firebug, you will see the proper output:

my app is running 
my test function has been called 
+1

인수에'. /'가 없으면 폴더에 있어야하지만,'./mymodule'을 수행하면 (이론적으로) 작동하지 않아야합니다. – loganfsmyth

+0

네, 맞았습니다. 코드를 수정했는데, 레포에 있습니다. 고맙습니다. – ceremcem

관련 문제