I was trying to move my JS files from app/assets/javascripts
to app/javascript
. Basically moving away from Asset Pipeline to Webpack.
I am getting multiple errors on the process.
1. The only thing I did is moved the file and removed the precompile statement from config/initializers/assets.rb
This is what I get:
DEPRECATION WARNING: The asset "disallow-char.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
2. Then I added the following on the html.haml
file:
```= javascript_include_tag 'disallow-char.js', skip_pipeline: true```
This is what I get:
Started GET "/javascripts/disallow-char.js" for ::1 at 2018-04-26 15:11:18 -0500
Processing by ErrorsController#routing as JS
Parameters: {"any_bad_route"=>"javascripts/disallow-char"}
::1 - - [26/Apr/2018:15:11:18 CDT] "GET /packs/application-26fc747cc9104717d89e.js HTTP/1.1" 304 0
And on the Browser I am getting this error:
GET http://localhost:3000/javascripts/disallow-char.js net::ERR_ABORTED
The location of the file is app/javascripts/frontend/disallow-char.js
My app/javascript/packs/application.js
looks as follows:
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
const frontend = require.context('../frontend', true, /\.js$/);
application.load(definitionsFromContext(frontend));
export default application;
Has anyone seen there error before? Anything that I am missing?