From scope022 at gmail.com Tue Jan 31 09:57:16 2017 Content-Type: multipart/mixed; boundary="===============5619550879795512859==" MIME-Version: 1.0 From: Brian Schofield To: keycloak-user at lists.jboss.org Subject: Re: [keycloak-user] Angular 2 with Webpack Date: Tue, 31 Jan 2017 08:57:13 -0600 Message-ID: In-Reply-To: FACD996F-E638-4C77-9C0D-7E3DF3D3448F@n-k.de --===============5619550879795512859== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable @Niko I found it to be webpack being the primary issue. In general webpack is exact definition of a bundler, in order for something to get included in the bundle either A: you need to have the appropriate loader B: you need to have the appropriate plugin If you're using webpack to build a distribution directory for your bundle then you need to move your static assets into that distribution directory as well because you don't want the name of your static assets to be changed into some hash based bundle format. Keycloak.js is looking for the exact name keycloak.json, if you let it go through the bundling process by requiring or importing keycloak.json then the output format in your bundle will likely be something like this keycloak.[hash].* For me I had to get keycloak.json to copy into the dist directory on build. The easiest way I found was to include the copy webpack plugin. Here's my quick instructions to get it running: *Within your package.json:* npm install copy-webpack-plugin --savedev *Within your webpack.config:* new CopyWebpackPlugin([{ from: 'keycloak.json', to: 'keycloak.json' }]) Result on build: Moves keycloak.json renames to keycloak.json adds to dist directory. If you have any questions let me know. On Tue, Jan 31, 2017 at 4:46 AM, Niko K=C3=B6bler wrote: > I didn=E2=80=99t have the time to dive really into it, but what I observe= d so long: > > - keycloak-js with React.js and plain JavaScript, bundled with Webpack 1 > works like a charm. > - keycloak-js with Angular 2 and TypeScript, bundled with Webpack 2 > results in errors. > > So, the cause might be Webpack 2 or TypeScript=E2=80=A6. > (I think it=E2=80=99s Typescript) > > My quick solution was to add keycloak-js with standard