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

compile throw error: shim with defined module cannot be evaluated correctly. #954

Open
miraclelife opened this issue Feb 8, 2017 · 1 comment

Comments

@miraclelife
Copy link

config in gruntfile.js
requireConfig.paths = {
........
'ejs': '../libs/ejs/ejs',
'tpl': '../libs/requirejs-ejs-plugin/rejs'
}
requireConfig.shim = {
........
'ejs': { exports: 'ejs' }
}
requirejs: {
compile: {
options: {
dir: 'jsc',
wrap: true,
baseUrl: 'js',
preserveLicenseComments: false,
removeCombined: true,
findNestedDependencies: true,
useStrict: true,
optimize: 'uglify2',
generateSourceMaps: false,
inlineText: true,
wrapShim: true,
paths: requireConfig.paths,
shim: requireConfig.shim,
modules: [{
name: 'login'
}]
}
}
}

login.js
define([
'flight/lib/component',
'hbs!loginTpl',
'configuration/plugins/registry',
'util/withDataRequest',
'tpl!util/alert',
'util/requirejs/promise!util/service/propertiesPromise'
], function(
defineComponent,
template,
registry,
withDataRequest,
alertTemplate,
configProperties) {
'use strict';
............
});

the document structure:
js
-- login.js
libs
--ejs/ejs
--requirejs-ejs-plugin/rejs

when run 'requirejs:compile' task throw error:
[INFO] Running "requirejs:compile" (requirejs) task
[INFO] ReferenceError: ejs is not defined
[INFO] In module tree:
[INFO] login
[INFO] tpl
[INFO] ejs
[INFO]
[INFO] { Error: ReferenceError: ejs is not defined
[INFO] In module tree:
[INFO] login
[INFO] tpl
[INFO] ejs
[INFO]
[INFO] at eval (eval at (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25281:64), :1:1)
[INFO]
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25865:19
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:3056:39
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:2996:25
[INFO] at Function.prim.nextTick (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25616:9)
[INFO] at Object.errback (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:2995:26)
[INFO] at Object.callback (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:2981:23)
[INFO] at Object.then (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:3035:23)
[INFO] at build (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25822:12)
[INFO] at runBuild (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:27831:17)
[INFO] at Object.execCb (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:1943:33)
[INFO] originalError:
[INFO] { ReferenceError: ejs is not defined
[INFO] at eval (eval at (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25281:64), :1:1)
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25281:55
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:3038:37
[INFO] at F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:2986:25
[INFO] at Function.prim.nextTick (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25616:9)
[INFO] at Object.callback (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:2985:26)
[INFO] at Object.then (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:3035:23)
[INFO] at Object.context.load (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:25269:28)
[INFO] at Object.load (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:1082:29)
[INFO] at Object. (F:\fusionminer\visallo\git-workspace\visallo-git\web\war\src\main\webapp\node_modules\requirejs\bin\r.js:1068:70)
[INFO] moduleTree: [ 'ejs', 'tpl', 'login' ],
[INFO] fileName: 'F:/fusionminer/visallo/git-workspace/visallo-git/web/war/src/main/webapp/jsc/ejs.js' } }

<node.version>v4.2.1</node.version>
<npm.version>3.3.8</npm.version>
requirejs -v 2.1.20

@miraclelife miraclelife changed the title compiler throw error: shim with defined module cannot be evaluated correctly. compile throw error: shim with defined module cannot be evaluated correctly. Feb 8, 2017
@platinumazure
Copy link

@miraclelife I can't speak for jrburke but I think it would help immensely if you formatted your post so that the code showed up as a code block. You can write a code block like this:

```js
// your code here
```

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