Closed oscarlaf03 closed 6 years ago
The file ends in .js
, but the test is for files that end in .erb
. Rename the file to jquery.js.erb
.
Closing this for now, we can reopen if there's any other confusion.
Hi @rhys-vdw thanks a for your answer. I tried to follow your recommendation but i don't have any 'jquery.js' file and the file from where I am causing the error already has the file extension *.js.erb
What are your thoughts?
app/javascript/components/moip.js.erb
// # [...]
let keyFromActiveRecord = <%= @tour_store.public_key %> ;
export {keyFromActiveRecord};
app/javascript/components/packs/application.js
import { keyFromActiveRecord } from '../components/moip';
console.log(keyFromActiveRecord);
This seems like an issue with the webpacker config. Perhaps try there.
Btw, once you solve the build error you'll probably get an error because the ERB scope doesn't include the field you're referencing.
Oh @oscarlaf03, just a thought...
Is it possible that you should add quotes? Perhaps you're getting some invalid output like:
let keyFromActiveRecord = <%= JSON.generate(@tour_store.public_key) %>;
export {keyFromActiveRecord};
Issue
Hi I've trying to configure my webpacker correctly in order to make use of attributes inside my instance classes as inputs for functions I am calculating on my javacripts But It seems I can't get the configuration right.
What are your thoughts?
Error message
I am getting a syntax error for
<%=
My settings
config/webpack/environment.js
config/webpacker.yml