Skip to content Skip to sidebar Skip to footer

Rails/webpack: Can't Access A Js Library

I'm trying to access the strftime JS library in my Rails application. I've followed the instructions on how to add it using yarn add and I've added a debugger statement in one of m

Solution 1:

You should try this in your config files:

// config/webpack/environment.js

const webpack = require('webpack');

const {environment} = require('@rails/webpacker');

environment.plugins.append(
  'ProvidePlugin-Strftime', // arbitrary name
  new webpack.ProvidePlugin({
    strftime: 'strftime'
  }),
);

module.exports = environment;

Post a Comment for "Rails/webpack: Can't Access A Js Library"