diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2022-05-09 17:57:57 +0000 |
---|---|---|
committer | Yamagishi Kazutoshi <ykzts@desire.sh> | 2022-09-11 16:05:01 +0000 |
commit | 64ee565b339eefbeb601200611f9fd08174135ef (patch) | |
tree | 6b33c9efa711ed0b820392f7eadd6bb9375ca6d7 /config/webpack/environments/development.js | |
parent | 0aacf00f5b77264537aa87fb8f78d7346feb1ec4 (diff) | |
download | mastodon-deps/shakapacker.tar mastodon-deps/shakapacker.tar.gz mastodon-deps/shakapacker.tar.bz2 mastodon-deps/shakapacker.zip |
Replace to shakapacker from webpackerdeps/shakapacker
Diffstat (limited to 'config/webpack/environments/development.js')
-rw-r--r-- | config/webpack/environments/development.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/config/webpack/environments/development.js b/config/webpack/environments/development.js new file mode 100644 index 000000000..9462f279f --- /dev/null +++ b/config/webpack/environments/development.js @@ -0,0 +1,39 @@ +const { env, merge } = require('shakapacker'); +const markRule = require('../rules/mark'); +const baseConfig = require('./base'); + +/** @type {import('webpack').Configuration} */ +let developmentConfig = { + module: { + rules: [ + markRule, + ], + }, +}; + +if (env.runningWebpackDevServer) { + developmentConfig = merge(developmentConfig, { + devServer: { + devMiddleware: { + writeToDisk: filePath => /ocr/.test(filePath), + }, + }, + }); +} + +if (process.env.VAGRANT) { + developmentConfig = merge(developmentConfig, { + devServer: { + static: { + watch: { + // If we are in Vagrant, we can't rely on inotify to update us with changed + // files, so we must poll instead. Here, we poll every second to see if + // anything has changed. + poll: 1_000, + }, + }, + }, + }); +} + +module.exports = merge({}, baseConfig, developmentConfig); |