Skip to content

Javascript not executing? #2955

@dmbrooking

Description

@dmbrooking

I really think this must be something really dumb and am hoping it's an easy fix.

I was having issues with mini-css-extract-plugin and undefined 'tap' method, but everything else was working fine. After some research, I saw the 6_0_upgrade.md doc so figured I'd try that. It did fix my CSS issue but now my Javascript won't execute in the browser, even though it compiles just fine.

I have stripped my application.js down so it is JUST a console.log statement.

/* eslint no-console:0 */
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

console.log('Hello World, from Webpacker!')

I've included this via <%= javascript_pack_tag "application" %>.

When I browse to a page, I can see in dev tools sources tab that it has loaded.

However, it just isn't console.logging anything. What could I be missing? This worked before going from webpacker 5.x to 6.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions