Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 15 15:20
    alanhg commented #1997
  • Sep 30 15:12
    bbrink68 commented #2049
  • Aug 23 13:34
    SouravKumar89 edited #2058
  • Aug 23 13:27
    SouravKumar89 opened #2058
  • Aug 22 00:04

    PatrickJS on master

    Update README.md (compare)

  • Aug 13 17:17
    ramsunvtech commented #1925
  • Aug 12 22:58
    terrancecorley commented #770
  • Aug 09 02:30
    jindovu commented #2049
  • Aug 09 02:22
    jindovu opened #2057
  • Aug 08 10:49
    krawinkelm commented #2053
  • Jul 21 14:14
    FilipLitwora commented #958
  • Jul 21 14:14
    FilipLitwora commented #958
  • Jul 21 14:14
    FilipLitwora commented #958
  • Jul 09 11:40
    Sanafan commented #1713
  • Jul 05 11:41
    hoang-innomizetech commented #2053
  • Jul 05 07:32
    Jilaba commented #1824
  • Jun 29 04:31
    Jason-Cooke synchronize #2055
  • Jun 28 14:51
    jesslilly commented #1827
  • Jun 12 18:16
    dvaldivia commented #1969
  • Jun 12 17:55
    dvaldivia commented #2049
Sam Jones
@ollwenjones
I know this app is going to get too big for that... besides chunk splitting is one of the main reasons to use webpack, imo
Sam Jones
@ollwenjones
I re-did the work without the require type definition, and still having trouble. Webpack is creating the split point, but getting errors at runtime trying to pass the promise-loader result as the AsyncRoute loader property. Either Type Error: Promise is not a Function... or if I wrap the "Promise" and return it, I get Type Error: loader(...).then is not a function. I'm new to interpreting zone.js traces and also new to TypeScript. Are those type-script errors or just JS errors?
binarious
@binarious
@ollwenjones TypeScript doesn't produce client-side errors, because the browser just runs the compiled js. Those are JavaScript errors. I can't help with the async loading though.
Niall O'Brien
@niallobrien
Hey guys, has anyone built a MEAN solution with this starter-pack?
Sam Jones
@ollwenjones
Thanks @binarious
Sam Jones
@ollwenjones

Finally sorted my problem, in case anyone else runs into issues with bundle-splitting and AsyncRoute. After looking at the ts-loader docs more closely:

//This just tells typescript to be ready for this type,
// the require call won't be emitted to webpack:
import SubModule = require('../submodule/submodule');

function loadSubModule() {
  var promise = new Promise<SubModule>((resolve, reject) => {
    require.ensure(['../submodule/submodule'], function(require) {
      /*from ts-loader example docs:*/
      // "These require calls are emitted (note these are NOT TypeScript
      // `import ... require` statements). `require.ensure` is defined in
      // require.d.ts. Webpack sees this and automatically puts submodule
      // into a separate chunk."
      var wrapper = <typeof submodule>require('../submodule/submodule');

      //wrapper is an object wrapper with a SubModule property,
      //which I did not expect
      resolve(wrapper.SubModule);
    });  
  });

  return promise;
}

then

@RouteConfig([
  { path: '/', component: Home, name: 'Index' },
  { path: '/home', component: Home, name: 'Home' },
  //{ path: '/sub', component: SubModule, name: 'SubModule' },
  new AsyncRoute({
    path: '/sub', loader:loadSubModule, name: 'SubModule'
  }),
  { path: '/**', redirectTo: ['Index'] }
])
Ruy Rodrigo Garcia Chavez
@rrgarciach
Hi. Can anyone explain me the functionality of the "..." at the beginning of a dependency name when passing in an array as a parameter?
bootstrap(App, [
    ...('production' === process.env.ENV ? [] : ELEMENT_PROBE_PROVIDERS),
    ...HTTP_PROVIDERS,
    ...ROUTER_PROVIDERS,
    provide(LocationStrategy, { useClass: HashLocationStrategy })
  ])
Sam Jones
@ollwenjones
It's an ES6 'spread operator' if I'm not mistaken, which you can google for better explanations than I could give, @rrgarciach. My understanding is all the members of the HTTP_PROVIDERS collection, for example, get added to that array as individual members in sequence.
binarious
@binarious
@ollwenjones Thanks for sharing your result!
Sam Jones
@ollwenjones
Now I just have to get rid of the type errors on the webpack console without breaking it... #newtotypescript
binarious
@binarious
@ollwenjones Can you send me the basic structure of the ../submodule/submodule file in a gist? I'd try to figure that out.
Artur Rozwalak
@arozwalak
I have a question about production version. after running npm run build:prod and start live-server in dist directory when I go to http://localhost:3000/ applications works and go through angular routing but when I refresh browser on any other view (not root '/') I receive Cannot GET /other-url
how should I configure my production environment so it can handle angular routes?
I'm using PathLocationStrategy
Artur Rozwalak
@arozwalak
anyway I will run my production version on nginx so maybe it will be enough to redirect all other routes to '/' with given path
Artur Rozwalak
@arozwalak
other problem when I try to run npm run server:prod I get EADDRINUSE but I don't have other process running on that port.
http-server dist --cors --host 0.0.0.0 --port 3000

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:8080
    at Object.exports._errnoException (util.js:856:11)
    at exports._exceptionWithHostPort (util.js:879:20)
    at Server._listen2 (net.js:1237:14)
    at listen (net.js:1273:10)
    at net.js:1382:9
    at nextTickCallbackWith3Args (node.js:489:9)
    at process._tickCallback (node.js:395:17)
    at Function.Module.runMain (module.js:432:11)
    at startup (node.js:141:18)
    at node.js:1003:3
Artur Rozwalak
@arozwalak
ok, I noticed that http-server has different parameters than set in webpack.config.js
it should be -a rather than --host and -p rather that --port
and for previous issue I just switched from PathLocationStrategy to HashLocationStrategy
Artur Rozwalak
@arozwalak
is it possibility that on prod version name of route isn't changed for 'n'?
when I'm running dev version of my project router.hostComponent.name returns proper namee of current route, but when I run prod version it's changed to 'n'
DavidXiao
@davidxiao
Hi, can somebody give me some idea how to pass 'o.webpackConfig.metadata.title' from webpack.conf.js to src/index.html
and what tool is it to use '{%= o.webpackConfig.metadata.title %}' in src/index.html?
I know html-webpack-plugin can pass variables into html file, but i didn't find it in webpack.config.js
DavidXiao
@davidxiao
found 'o' in html-webpack-plugin,
but no idea about what tool for {% %}, and where to set
DavidXiao
@davidxiao
blueimp-tmpl
rvalimaki
@rvalimaki
Hi, trying to add jQuery, SASS & Bootstrap using directions from AngularClass/angular2-webpack-starter#215 . Everything works fine with dev mode, but somehow building in prod mode ends up with problems:

75% hashingC:\fastems\MMS5\MMS_NG\angular2-webpack-starter\node_modules\webpack-md5-hash\plugin\webpack_md5_hash.js:27
var source = chunk.modules.sort(compareModules).map(getModuleSource).reduce(concatenateSource);
^

TypeError: Reduce of empty array with no initial value
at Array.reduce (native)

also the plain webpack starter without adding jQuery, SASS & Bootstrap is working fine also with "npm run build:prod"
rvalimaki
@rvalimaki
Oh well, might be related to missing new line after vendor.ts ;-)
Branko Ilic
@brankoiliccc
hey guys. I` have cloned angular2-webpack-starter , but when i run npm install i get error
'cp' is not recognized as an external or internal command, operable program or batch file
any idea whats causing this error?
Sam Jones
@ollwenjones
@brankoiliccc what OS are you on? Windows, I assume?
Branko Ilic
@brankoiliccc
Hello sorry was afk yeah win 10
Branko Ilic
@brankoiliccc
Guess this is starter for linux right? Do you happen to have win version maybe ^_^ btw i am having such a hard time putting my angular2 app together for production. I will probably switch to thymeleaf+jquery for my spring boot app. Coming from Java background i just cant figure out why is simple import and packaging so complicated. Instead improving my coding skills and finding better solutions for problems i have spent better part of the last week just trying to bundle my js files into one... kinda silly if you ask me. Not that i dont appreciate the effort you guys put. It just the thing with most javascript frameworks. Way more complicated and messy than it needs to be.
Sam Jones
@ollwenjones
@brankoiliccc have you been doing 'npm' install on your windows box successfully in other projects? I think it's pretty common to install the linux commands (cygwin) when installing git on windows, which should take care of the 'cp' problem. It's a general npm / command line on windows problem though, not one with this seed project.
if you google your 'cp' error, you should be able to find a few workarounds
I would say that if your production app has a fairly short release schedule, though, angular 2 would be kind of risky, as so much is still changing.
For a short-term production app I would suggest Angular 1.x or React.
Branko Ilic
@brankoiliccc
@ollwenjones Well i havent had problems with npm install before. Anyways i am gonna give it a try on another machine with Linux on it. Release schedule is not the problem. Problem is Angular2/typescript/react/weback are all new concepts for me so i wanted to make it as simple as possible. Bundle everything with webpack, reference from my spring boot template and have everything run all together with mvn spring-boot:run command. Keep it as simple as possible. I must admit my angular2 knowledge is limited so at every step of the way i need to check is everything still working or did i make a mistake, even for the simplest things.
Sam Jones
@ollwenjones
I hear you... All pretty new to me as well, which is why I'm thankful for folks like are on here. ;) Maybe double-check your node/npm versions are up to date with what this project specified?
Branko Ilic
@brankoiliccc
yeah will do. Probably gonna take a break and clear my mind. Had too much coffee :)
Sam Jones
@ollwenjones
been there too.
Jason Miazga
@jmiazga
were having troubles adding underscore to the project, is there an example to get this to work?
Sam Jones
@ollwenjones
I thought I had added momentjs successfully, but I guess not now that I actually tried to use it.
Jason Miazga
@jmiazga
we installed underscore and its typings, but cant successfully use it
Sam Jones
@ollwenjones
I had added lodash and open layers to a previous version of this seed, but it was for a proof of concept and seemed kind of hackneyed:
var _ = require('../../../node_modules/lodash');
var ol = require('../../../node_modules/openlayers');
Jason Miazga
@jmiazga
i dont like the relative paths and the reference to the node_modules folder
is there a cleaner way to do it? i saw a custom._typings.d.ts was added at one point, do I need to do something with that also?