small medium large xlarge

Generic-user-small
13 Oct 2017, 20:49
Pema (1 post)

Hello all:

I am reading the eighth chapter of book. Everything worked so far, but now I am having some problem with CustomerDetailsComponent/template.html. I installed html-loader, I created the file ./webpack/loaders/html.js and everything else. When I run foreman start I get some errors compiling webpack:

webpack.1 | ERROR in ./app/javascript/CustomerDetailsComponent/template.html
 
 webpack.1 | Module parse failed: /home/.../webs/shine/app/javascript/CustomerDetailsComponent/template.html Unexpected token (1:0)
20:55:22 webpack.1 | You may need an appropriate loader to handle this file type.
20:55:22 webpack.1 | | <h1>Customer Details!</h1>
20:55:22 webpack.1 |  @ ./app/javascript/CustomerDetailsComponent/index.ts 2:0-39
20:55:22 webpack.1 |  @ ./app/javascript/packs/customers.js
20:55:22 webpack.1 |  @ multi (webpack)-dev-server/client?http://localhost:3035 ./app/javascript/packs/customers.js

and ...

ERROR in ./app/javascript/CustomerSearchComponent/template.html
20:55:22 webpack.1 | Module parse failed: /home/.../webs/shine/app/javascript/CustomerSearchComponent/template.html Unexpected token (1:0)
20:55:22 webpack.1 | You may need an appropriate loader to handle this file type.
20:55:22 webpack.1 | | <header>
20:55:22 webpack.1 | |   <h1 class="h2">Customer Search</h1>
20:55:22 webpack.1 | | </header>
20:55:22 webpack.1 |  @ ./app/javascript/CustomerSearchComponent/index.ts 3:0-39
20:55:22 webpack.1 |  @ ./app/javascript/packs/customers.js
20:55:22 webpack.1 |  @ multi (webpack)-dev-server/client?http://localhost:3035 ./app/javascript/packs/customers.js

Any clue?. Thanks in advance and sorry for my bad english.

Dmfcb_pragsmall
14 Oct 2017, 17:14
David Copeland (511 posts)

My fear is that Webpacker 3 is biting you—it was released after the book went to print and changes the configuration for Webpack.

Can you try undoing the webpack work you did, using Webpacker 2.x and seeing if that works?

In your gemfile, you’d put:

gem "webpacker", "~> 2.0"

and then bundle install

Generic-user-small
13 Jan 2018, 13:06
Grzegorz (12 posts)

The solution is provided here. It helps me in chapter 8.

Downgrading webpacker to 2.0 blewed up my app. Not sure if its because downgrading itself or because meddling with karma/jasmine/babel/etc installations while trying to make karma work with webpacker 3.0 in chapter 7.

You must be logged in to comment