These are chat archives for canjs/canjs

11th
Aug 2016
Leath Cooper
@IcculusC
Aug 11 2016 00:02
is can/view/stache not 2.x
Justin Meyer
@justinbmeyer
Aug 11 2016 04:10
@RALifeCoach are you trying to build a 2.3 or 3.0 app?
it also seems you are trying to build a DoneJS app
I don't think you're getting started, so I'm not sure where these problems suddenly sprung up. If you're making a DoneJS app, the guides work and should create a working boilerplate app. But again, I'm not sure where you are. Did you create a forum post?
there is no can/view/stache in 3.0
Justin Meyer
@justinbmeyer
Aug 11 2016 04:21
just pushed out some more docs updates: http://canjs.github.io/canjs/ ... lots of little fixes in can-connect, can-stache-bindings updates, can-set updates
Christopher Oliphant
@RALifeCoach
Aug 11 2016 11:27
@justinbmeyer I am trying to build 3.0 can app
Christopher Oliphant
@RALifeCoach
Aug 11 2016 12:33
I am able to get the build to work! New question. I want the build to separate out can files amd non-can files
@justinbmeyer ^^
Matthew Phillips
@matthewp
Aug 11 2016 12:49
@RALifeCoach why?
I don't think we have a way to allow you to customize the build in that way
Christopher Oliphant
@RALifeCoach
Aug 11 2016 12:54
because these modules fit into a larger infrastructure
They become components in a CMS
We don’t want to bundle all of canjs in with each component
in 2.3, not using steals, we were okay because we could include the canjs libraries separately
Julian
@pYr0x
Aug 11 2016 13:02
you can use multi main
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:03
@pYr0x sounds great - can you point me to the documentation on that?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:12
Please point me to the documentation
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:21
@pYr0x @justinbmeyer Can someone point me to the documentation?
here is a test repo i created, it is not up-to-date. i can make a PR later this day
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:29
thanks
Julian
@pYr0x
Aug 11 2016 13:29
with new build and working build
see also
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:30
I had found the many-problems item - that’s how I managed to get build to work
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:31
but neither example have main: [‘xxx’, ‘yyy’]
Julian
@pYr0x
Aug 11 2016 13:31
?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:31

Multi-page use
The following uses steal-tool's build method to programatically build out the "login" and "homepage" modules as bundles.

var stealTools = require("steal-tools");

var promise = stealTools.build({
main: ["login","homepage"],
config: __dirname+"/config.js"
},{
bundleSteal: true,
// the following are the default values, so you don't need
// to write them.
minify: true,
debug: false,
quiet: false,
bundleDepth: 3,
mainDepth: 3
});

Julian
@pYr0x
Aug 11 2016 13:31
which examples?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:32
builtit and many problems - in both cases the build.js only has a single main
Julian
@pYr0x
Aug 11 2016 13:32
you have to define a main entry point
in my repo?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:34
The documentation you pointed me to says to do a multiBuild you specify main: [‘xxx’, ‘yyy’]. You then sent me two examples neither one had this multiple mains in their build.js.
Julian
@pYr0x
Aug 11 2016 13:34
as i said ;)
it is not up-to-date. i can make a PR later this day
Christopher Oliphant
@RALifeCoach
Aug 11 2016 13:35
okay - I will wait until then
Julian
@pYr0x
Aug 11 2016 13:36
k
i will inform you
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:48
That is still using can 2.3. I need can 3.0
Julian
@pYr0x
Aug 11 2016 16:49
oh
but there is not difference
because the build is provided by steal
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:54
I tried converting your code to 3.0, building and running - no success
the build runs, but the page does not work
Julian
@pYr0x
Aug 11 2016 16:55
waht do you mean with "not success"?
what is the error?
how does the productive code look like (html)
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:56
Here is the prod html when built with steal included:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Production Site 1</title>
</head>
<body>

<h2>Production Site 1</h2>
<div id="output"></div>

<script src="dist/bundles/main-main.js"></script>
</body>
</html>
Julian
@pYr0x
Aug 11 2016 16:56
??
main-main.js?
do you have a package.json?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:57
that’s what is genrated when I build with main: [‘dev1’, ‘dev2’]
Julian
@pYr0x
Aug 11 2016 16:57
are u using npm?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:57
here is the package.json
{
  "name": "buildit",
  "version": "1.0.0",
  "description": "a built test app",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "node build"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "can-component": "^3.0.0-pre.14",
    "can-define": "^0.7.15",
    "can-map": "^3.0.0-pre.8",
    "can-set": "^0.5.6",
    "can-stache": "^3.0.0-pre.13",
    "can-view-model": "^3.0.0-pre.4",
    "jquery": "^2.2.0",
    "steal": "^0.16.33",
    "steal-tools": "^0.16.6",
    "steal-stache": "^3.0.0-pre.3"
  },
  "devDependencies": {
  },
  "system": {
    "npmIngore": [
      "devDependencies"
    ],
    "npmAlgorithm": "flat",
    "directories": {
      "lib": "src"
    },
    "meta": {
    },
    "envs": {
      "build": {
        "map": {
          "jquery": "http://code.jquery.com/jquery-2.2.0.min",
          "jquery/jquery": "http://code.jquery.com/jquery-2.2.0.min"
        }
      },
      "window-development": {
        "map": {

        }
      },
      "window-production": {
        "map": {
          "jquery": "http://code.jquery.com/jquery-2.2.0.min",
          "jquery/jquery": "http://code.jquery.com/jquery-2.2.0.min"
        }
      }
    }
  }
}
Julian
@pYr0x
Aug 11 2016 16:57
ok
so the name of the app is "buildit"
do you bundle steal with the build or not?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:58
in this case, yes
Julian
@pYr0x
Aug 11 2016 16:58
the question would be... would you bundle steal?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 16:59
I want the package js files to be as small as possible
I was just playing with different options to try and get it to work
Julian
@pYr0x
Aug 11 2016 16:59
as small as possible you can have a look at
but back to basic
in my build
i used
// prod 1
// var buildPromise = stealTools.build({
//     main: ["buildit/dev1/main", "buildit/dev2/main"],
//     config: __dirname + "/package.json!npm"
// },{
//     bundleSteal: true,
//     minify: false
// });
"buildit/dev1/main" => "APPNAME/PATH_TO_MAIN_IN_SRC_FOLDER"
if you bundle steal
dist/bundles/buildit/dev1/main.js
dist/bundles/APPNAME/PATH_TO_MAIN_AS_THE_SAME_IN_BUILD_MAIN.js"
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:02
That works for when you do not use mutlibuild
Julian
@pYr0x
Aug 11 2016 17:03
?
i do
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:04
Sorry
Just trying to get it running again
Julian
@pYr0x
Aug 11 2016 17:08
k
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:11
For some reason the browser can’t find the file. I ran into this earlier, but had it working
what is the recommended way to start the app?
I am using a service via WebStrom
Julian
@pYr0x
Aug 11 2016 17:13
i using http-server
installed from npm
you can have any webserver
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:15
okay - that’s working for dev1 - with steal included
Julian
@pYr0x
Aug 11 2016 17:16
so whats the error?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:17
No error
I am now trying to get dev2 to work
Julian
@pYr0x
Aug 11 2016 17:17
but you have to get work "prod.html"
not dev
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:21
I built both modules with steal included. I can get dev1 to run, but not dev2
It’s looking for index.js
main.js:2655 GET http://localhost:8080/src/index.js 404 (Not Found)fetchTextFromURL @ main.js:2655(anonymous function) @ main.js:2830init @ main.js:384Promise @ main.js:372value @ main.js:2829loader.fetch @ main.js:3644loader.fetch @ main.js:4712loader.fetch @ main.js:4812System.fetch @ main.js:7025(anonymous function) @ main.js:1532tryCatchReject @ main.js:1190runContinuation1 @ main.js:1149Fulfilled.when @ main.js:937Pending.run @ main.js:828Scheduler._drain @ main.js:104Scheduler.drain @ main.js:69run @ main.js:275
main.js:6402 TypeError: Error loading "buildit@1.0.0#index" at http://localhost:8080/src/index.js(…) "TypeError: Error loading "buildit@1.0.0#index" at http://localhost:8080/src/index.js
Cannot read property 'forwardSlashMap' of undefined
    at Object.name (http://localhost:8080/dist/bundles/buildit/dev2/main.js:7118:36)
    at Loader.retryFetch (http://localhost:8080/dist/bundles/buildit/dev2/main.js:7094:73)
    at retryAll (http://localhost:8080/dist/bundles/buildit/dev2/main.js:7038:63)
    at http://localhost:8080/dist/bundles/buildit/dev2/main.js:7029:32
    at tryCatchReject (http://localhost:8080/dist/bundles/buildit/dev2/main.js:1190:30)
    at runContinuation1 (http://localhost:8080/dist/bundles/buildit/dev2/main.js:1149:4)
    at Rejected.when (http://localhost:8080/dist/bundles/buildit/dev2/main.js:970:4)
    at Pending.run (http://localhost:8080/dist/bundles/buildit/dev2/main.js:828:13)
    at Scheduler._drain (http://localhost:8080/dist/bundles/buildit/dev2/main.js:104:19)
    at Scheduler.drain (http://localhost:8080/dist/bundles/buildit/dev2/main.js:69:9)"(anonymous function) @ main.js:6402tryCatchReject @ main.js:1190runContinuation1 @ main.js:1149Rejected.when @ main.js:970Pending.run @ main.js:828Scheduler._drain @ main.js:104Scheduler.drain @ main.js:69run @ main.js:275
main.js:147 Potentially unhandled rejection [6] TypeError: Error loading "buildit@1.0.0#dev2/main" at http://localhost:8080/src/dev2/main.js
require is not a function
    at Function.<anonymous> (http://localhost:8080/dist/bundles/buildit/dev2/main.js:15792:5)
    at execute (http://localhost:8080/dist/bundles/buildit/dev2/main.js:4324:32)
    at linkDynamicModule (http://localhost:8080/dist/bundles/buildit/dev2/main.js:3576:32)
    at linkDynamicModule (http://localhost:8080/dist/bundles/buildit/dev2/main.js:3570:11)
    at link (http://localhost:8080/dist/bundles/buildit/dev2/main.js:3436:11)
    at Object.execute (http://localhost:8080/dist/bundles/buildit/dev2/main.js:3755:11)
    at doDynamicExecute (http://localhost:8080/dist/bundles/buildit/dev2/main.js:1956:25)
    at link (http://localhost:8080/dist/bundles/buildit/dev2/main.js:2004:24)
    at doLink (http://localhost:8080/dist/bundles/buildit/dev2/main.js:1778:7)
    at updateLinkSetOnLoad (http://localhost:8080/dist/bundles/buildit/dev2/main.js:1826:18)(anonymous function) @ main.js:147report @ main.js:174flush @ main.js:196
Once I have this working, then I need to try again without steal
Julian
@pYr0x
Aug 11 2016 17:25
what is forwardSlashMap
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:26
I have no idea
Julian
@pYr0x
Aug 11 2016 17:26
you are using steal 1.0?
Gregg Roemhildt
@roemhildtg
Aug 11 2016 17:26
I've gotten that error before. I had my app running in /subdirectory/myapp/... I fixed it by specifying a base-url attribute
Julian
@pYr0x
Aug 11 2016 17:28
@RALifeCoach pls provide a repo that i can try myself
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:29
sure - I cloned the original repo you sent me
do you want me to create a branch and check it in?
I can’t do that as I don’t have permission to push a new branch to your repo
Julian
@pYr0x
Aug 11 2016 17:31
ok wait
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:33
I can create a new repo
Julian
@pYr0x
Aug 11 2016 17:34
as you wish
sent you an invite
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:39
Okay - the new branch is canjs30
Julian
@pYr0x
Aug 11 2016 17:46
you are not using steal 1.0
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:50
No - I said earlier that I had taken your previous code and converted it to canjs 3.0
Julian
@pYr0x
Aug 11 2016 17:51
this is a working branch.. master is outdated
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:52
okay - then I will need to convert to 3.0 again
I want this example to work in 3.0. Then I know I can move ahead
Julian
@pYr0x
Aug 11 2016 17:52
which example
that in your branch?
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:53
My branch uses canjs 3.0
Julian
@pYr0x
Aug 11 2016 17:53
but steal 0.16
Christopher Oliphant
@RALifeCoach
Aug 11 2016 17:53
okay - let me get steal1.0 branch
Julian
@pYr0x
Aug 11 2016 17:54
ok
Julian
@pYr0x
Aug 11 2016 18:07
i will be now AFK maybe back in 1 -2 hours
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:07
Okay - I am running build and nothing is happening
Julian
@pYr0x
Aug 11 2016 18:08
push to the repo i will look into
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:08
no errors - no files being produced
okay - will do
same branch? steal-1.0?
Julian
@pYr0x
Aug 11 2016 18:08
you are using the prod 1?
a new pls
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:08
I am running node build.js
Julian
@pYr0x
Aug 11 2016 18:08
you have to comment out in build.js
all builds are commented
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:09
I hadn’t looked in build.js
Julian
@pYr0x
Aug 11 2016 18:09
you have to
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:09
Apparently :-)
Now I can fix errors and test
I’ll keep you up to date as I progress
Julian
@pYr0x
Aug 11 2016 18:10
k
Christopher Oliphant
@RALifeCoach
Aug 11 2016 18:21
Okay - here is the new status. The code is converted to 3.0. The build (with steal) is working. subfolder/prod_1.html runs successfully. I created subfolder/prod_2.html. It has an error loading, but does show the button and does write ‘test’ to the console. At this point in time I need to run. The new branch is steal-1.0-can-3.0.
Please check out my branch and run prod_2.html. You will see errors in the console log.
I haven’t tested building and running with bundleSteal set to false.
I will try that when I am back infront of my computer
Christopher Oliphant
@RALifeCoach
Aug 11 2016 19:30
I’m back online
Christopher Oliphant
@RALifeCoach
Aug 11 2016 19:41
I ran the build without steal and other than a number of errors due to missing package.json files, the code loaded and ran. That’s the good news.
The bad news is that the code with steal bundled is HUGE! Way too big for our needs. The code without steal bundled is only huge. Still too big for our needs. And without steal, the code parses all the package.json files and loads many, many files during page load. Also not viable for us.
Leath Cooper
@IcculusC
Aug 11 2016 19:57
how big is huge
@RALifeCoach
Christopher Oliphant
@RALifeCoach
Aug 11 2016 20:07
With steal 500kb. Without steal 400kb.
This is for a tiny test app with one label and one button that logs to the console when clicked.
Leath Cooper
@IcculusC
Aug 11 2016 21:14
true, well it's important to consider that that's not an insanely large application, and even when your code becomes more robust most of that overhead is in the dependencies so it's not going to grow to some insane size by adding more of your own functionality
it is kinda big, but nothing that's going to break the bank, and packaged and minified and mangled it would be a lot smaller
Julian
@pYr0x
Aug 11 2016 21:51
@RALifeCoach what do you meam with huge
do you use multimain ?
And without steal, the code parses all the package.json files and loads many, many files during page load
what does that mean
in produciton it should not load many files
are you really in production mode?
i dont think so
pls read the documentation
you can also use a CDN for public libraries
to say the bundle is HUGE without trying all solutions is bad
Leath Cooper
@IcculusC
Aug 11 2016 22:13
man I love steal lol
Julian
@pYr0x
Aug 11 2016 22:15
?
Leath Cooper
@IcculusC
Aug 11 2016 22:16
I just think it's a good tool
I like the minimal configuration
Julian
@pYr0x
Aug 11 2016 23:22
@RALifeCoach i clean up the code
remove jquery and use vanilla js + cleanup build + minify source
will reduce the code to 140 KB without steal
in 140 KB canjs is fully included. so if you add more components, the size will not increase very much because canjs is still included
Christopher Oliphant
@RALifeCoach
Aug 11 2016 23:29
@pYr0x when you run the page and view network requests, how many requests does it make?
Julian
@pYr0x
Aug 11 2016 23:29
4 or 5
inclusive css
i pushed a commit
make abuild
open prod_2
before remove node_modules and make a clean install
i edit the package.json
Julian
@pYr0x
Aug 11 2016 23:37
i am out...