This is the first time that I’m writing a blog. I don’t know how to write and how it will be. No worries it will be perfect when I will have enough experience in writing blogs. Just need to start writing first.

Self Introduction

I’m Islam Md Sahidul. My nickname is Sahid. I’m from Bangladesh. I’ve joined dely on 15th June 2021. I’m working at Kurashiru delivery as a backend engineer. I have good experience in Ruby on Rails and JavaScript. I have moved to Japan in September 2019. I love Japan, Japanese culture, norms, and values. I also love Japanese food 🍱 🥘 though I have some restrictions on foods.

be-the-sun.webp

Today I would like to explore the new features of Rails 7. Though I haven’t used Rails 7 but checked out the new features.

Node and Webpack not needed

To use JavaScript in Rails 7 you don’t need node and webpack and you still can include node package. Now by default rails 7 use importmaps-rails gem that will help you to import node packages without writing package.json.

For example, you want to import ‘moment’ node package just run below command -

./bin/importmap pin moment

This will add a line in config/importmap.rb like:

pin "moment", to: "<https://ga.jspm.io/npm:[email protected]/moment.js>"

The below screenshot shows what you will see when you run pin any package by importmap -

Screen Shot 2021-12-24 at 5.41.57 PM.png

Now you can use moment as like usual.

One thing you can’t use React jsx or Typescript like this. For that, you need to use webpack/rollup/esbuild and still, you can install webpack and setup it by below command.