-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Be smarter about setting up stringjs #317
Comments
Is there a way around this, without rewriting Simple Schema? I tried to wrap my meteor app as a desktop app, with the framework Electron. And for this I use requirejs. I get errors like:
|
I solved it for my purpose by forking the Simple Schema repository, and by rewriting the following code snippet:
So it looks like the code snippet below:
It tests if |
I am also having this issue and on top of that if I go to the console and I run: window.require("string"); I get undefined back ... is that the only solution I can apply here? By the way my issue with Simple-Schema is only when reference another schema, ex: var a = new SimpleSchema({
name: {
type: String
}
});
var b = new SimpleSchema({
someNames: {
type: [a]
}
}); Any suggestion here? |
For those running into this issue with Electron, you can add S to the window object inside of a pre-script, instead of forking and customizing the simple schema package. So... Inside of your electron root: npm install string --save Inside of a js file, in your electron root, like browser-setup.js S = require('string'); Then, in your main.js electron file (or wherever your entry point is), when you create your browser window: // Create the browser window.
// Here, we have it load the browser-setup.js pre-script,
// which runs in the context of the meteor app, before any of the meteor app js is loaded.
// This is also how you make native node modules available to your meteor app.
mainWindow = new BrowserWindow({
'web-preferences': {
preload: Path.resolve(Path.join(__dirname, 'browser-setup.js')),
}
})
// Load the meteor app in the browser window
mainWindow.loadUrl('http://localhost:3000'); |
Anyone still facing this problem, can check out the code in the PR #480 as workaround till the PR is merged. |
I merged @marcodejongh's PR and will release it soon after I have fixed a few other things. |
If requirejs is used, like if raix:famono pkg is added to the app, then
window.S
won't be set soS
will be undefined. This might be a good time to pull out the pieces of stringjs that we're using and eliminate that dependency altogether.The text was updated successfully, but these errors were encountered: