리눅스는 사용자당 inotify 감시 개수에 상한(max_user_watches)이 있다1 — 모자라면 webpack 이 변경을 못 알아챈다2.

# `System limit for number of file watchers reached`

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Footnotes

  1. inotify(7) - Linux manual page: “/proc/sys/fs/inotify/max_user_watches This specifies an upper limit on the number of watches that can be created per real user ID.” ↩

  2. Watch and WatchOptions | webpack: “Verify that you have enough available watchers in your system. If this value is too low, the file watcher in Webpack won’t recognize the changes” ↩

#234

webpack 은 .mjs 를 javascript/esm 으로 고정해 CommonJS 를 막는다1 — type 을 직접 주면 그 기본 규칙을 건너뛴다2.

configureWebpack: {
    module: {
      rules: [
        {
          test: /\.mjs$/,
          include: /node_modules/,
          type: 'javascript/auto',
        },
      ],
    },
  },

Footnotes

  1. Module Methods | webpack: “.mjs or .js with "type": "module" in package.json” → “No CommonJS allowed, for example, you can’t use require, module.exports or exports”. webpack 4 기본 규칙: { test: /\.mjs$/i, type: "javascript/esm" } ↩

  2. Module | webpack: “Rule.type sets the type for a matching module. This prevents defaultRules and their default importing behaviors from occurring.” ↩

#292