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

[1.3-modules-beta.2] Ensure smooth upgrade from Meteor 1.2 #5884

Closed
trusktr opened this issue Dec 26, 2015 · 11 comments
Closed

[1.3-modules-beta.2] Ensure smooth upgrade from Meteor 1.2 #5884

trusktr opened this issue Dec 26, 2015 · 11 comments
Milestone

Comments

@trusktr
Copy link
Contributor

trusktr commented Dec 26, 2015

I think the meaning of "lazy" in the docs means files in an imports folder won't be loaded unless they are imported by another file.

I've got client/imports/foo/index.js

import $ from 'jquery'
console.log($)

which isn't imported by anything. Chrome says

Uncaught SyntaxError: Unexpected token import

and the Sources tab shows

(function(){
import $ from 'jquery'
console.log($)

}).call(this);

for client/imports/foo/index.js.

@trusktr
Copy link
Contributor Author

trusktr commented Dec 26, 2015

Nevermind, meteor add modules. x}

@trusktr trusktr closed this as completed Dec 26, 2015
@trusktr
Copy link
Contributor Author

trusktr commented Dec 26, 2015

Will adding modules be required in Meteor 1.3?

@trusktr
Copy link
Contributor Author

trusktr commented Dec 26, 2015

Nevermind the nevermind, after installing modules, files in imports are still being loaded. app.js in the Sources tab looks like

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// This is a generated file. You can view the original                  //
// source in your browser if your browser supports source maps.         //
// Source maps are supported by all recent versions of Chrome, Safari,  //
// and Firefox, and by Internet Explorer 11.                            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


(function () {

/* Imports */
var Foo = Package.mongo.Foo;
// a bunch of other things imported via `Package.*`

var require = meteorInstall({"app":{"client":{"imports":{"foo.js":function(require,exports,module){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                     //
// client/imports/foo.js                                                                                               //
//                                                                                                                     //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                       //
                                                                                                                       // 1
/* global reset */                                                                                                     // 2
export default {                                                                                                       // 3

// and the rest of the file...

Installing modules also installed ecmascript, yet there's an export statement there, which causes

Uncaught SyntaxError: Unexpected token export

What am I missing?

@trusktr trusktr reopened this Dec 26, 2015
@trusktr
Copy link
Contributor Author

trusktr commented Dec 26, 2015

I was able to get Meteor 1.3 modules working in one project, but I'm not sure why it doesn't work in this one: https://github.com/trusktr/site/tree/8a151f953458ae8080902e879d6cf3df4dc7a5ee

Just run meteor. The entry point is client/main.js.

@trusktr
Copy link
Contributor Author

trusktr commented Dec 26, 2015

I'm going to close this one and start newer more concise issue.

@trusktr trusktr closed this as completed Dec 26, 2015
@trusktr trusktr reopened this Dec 27, 2015
@trusktr
Copy link
Contributor Author

trusktr commented Dec 27, 2015

Re-opening as I think I found what might be causing this weird behavior I'm having: I took an app that was on Meteor 1.2-preview with a .meteor/packages file that look like this:

meteor-platform
rocket:module
kadira:flow-router

Then I updated it to 1.2.1, and then 1.3-modules-beta.2, which made it look like this (before adding modules):

rocket:module
kadira:flow-router
meteor-base
mobile-experience
mongo
blaze-html-templates
session
jquery
tracker
logging
reload
random
ejson
spacebars
check

There seems to be something wrong with that, because here's what .meteor/packages looks like (before adding modules) for a freshly created app that I updated directly to 1.3-modules-beta.2:

meteor-base             # Packages every Meteor app needs to have
mobile-experience       # Packages for a great mobile UX
mongo                   # The database Meteor supports right now
blaze-html-templates    # Compile .html files into Meteor Blaze views
session                 # Client-side reactive dictionary for your app
jquery                  # Helpful client-side library
tracker                 # Meteor's client-side reactive programming library

standard-minifiers      # JS/CSS minifiers run for production mode
es5-shim                # ECMAScript 5 compatibility for older browsers.
ecmascript              # Enable ECMAScript2015+ syntax in app code

autopublish             # Publish all data to the clients (for prototyping)
insecure                # Allow all DB writes from clients (for prototyping)

The package list is different than the one where I upgraded from 1.2-preview. I replaced the .meteor/packages in the messed up project with the one from the newly created project, which fixed the problem.

The issue here might be that Meteor 1.3 and modules might not work for some people updating from 1.2 (preview?).

It's not a big deal, I can just start a new project, then copy my files (and .git) over :]

@stubailo stubailo changed the title [1.3-modules-beta.2] Files in "imports" folder are loading automatically instead of "lazily"? [1.3-modules-beta.2] Ensure smooth upgrade from Meteor 1.2 Dec 29, 2015
@stubailo stubailo added this to the Release 1.3 milestone Dec 29, 2015
@avital
Copy link
Contributor

avital commented Jan 7, 2016

@trusktr This thread is very confusing. Can you summarize what your current actual problem is?

@trusktr
Copy link
Contributor Author

trusktr commented Jan 8, 2016

Make a Meteor 1.2 app, then update to Meteor 1.3 beta.2 and add the modules package. It seems that .meteor/packages doesn't get properly updated by Meteor, and it won't work. The workaround is to make a new empty Meteor 1.3 beta.2 app, then replace meteor-platform with the list of packages that you see in a default Meteor 1.3 beta.2 app.

This problem might need to be fixed before the release of 1.3 stable or it will break people's app when they update to 1.3.

@trusktr
Copy link
Contributor Author

trusktr commented Jan 8, 2016

This might also be related to #5885; I'm not sure.

@avital
Copy link
Contributor

avital commented Jan 21, 2016

We're going to look at this as part of a more general issue: #5830.

(I'm surprised that you got that issue upgrading from 1.2. I think 1.2 already lists the specific packages you need rather than meteor-platform)

@avital avital closed this as completed Jan 21, 2016
@trusktr
Copy link
Contributor Author

trusktr commented Jan 23, 2016

This problem might be gone in beta 3. I updated to beta.3 from a 1.2 app the other day, and instead of Meteor modifying .meteor/packages, Meteor left it the same, leaving the meteor-platform entry intact. Adding modules worked this time. This is unlike the previous behavior I mentioned when upgrading from beta.2, which does modify .meteor/packages.

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

3 participants