diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index e94f8140c..000000000 --- a/.browserslistrc +++ /dev/null @@ -1 +0,0 @@ -defaults diff --git a/app/javascript/channels/consumer.js b/app/packs/channels/consumer.js similarity index 100% rename from app/javascript/channels/consumer.js rename to app/packs/channels/consumer.js diff --git a/app/javascript/channels/index.js b/app/packs/channels/index.js similarity index 100% rename from app/javascript/channels/index.js rename to app/packs/channels/index.js diff --git a/app/javascript/controllers/coreui_sidebar_controller.js b/app/packs/controllers/coreui_sidebar_controller.js similarity index 100% rename from app/javascript/controllers/coreui_sidebar_controller.js rename to app/packs/controllers/coreui_sidebar_controller.js diff --git a/app/javascript/controllers/index.js b/app/packs/controllers/index.js similarity index 100% rename from app/javascript/controllers/index.js rename to app/packs/controllers/index.js diff --git a/app/javascript/packs/application.js b/app/packs/entrypoints/application.js similarity index 100% rename from app/javascript/packs/application.js rename to app/packs/entrypoints/application.js diff --git a/app/javascript/turbolinks/coreui.js b/app/packs/turbolinks/coreui.js similarity index 100% rename from app/javascript/turbolinks/coreui.js rename to app/packs/turbolinks/coreui.js diff --git a/config/webpack/base.js b/config/webpack/base.js new file mode 100644 index 000000000..dedabcc40 --- /dev/null +++ b/config/webpack/base.js @@ -0,0 +1,8 @@ +const { webpackConfig, merge } = require('@rails/webpacker') +const customConfig = { + resolve: { + extensions: ['.css'] + } +} + +module.exports = merge(webpackConfig, customConfig) diff --git a/config/webpack/development.js b/config/webpack/development.js index c5edff94a..c84a413b5 100644 --- a/config/webpack/development.js +++ b/config/webpack/development.js @@ -1,5 +1,5 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development' -const environment = require('./environment') +const webpackConfig = require('./base') -module.exports = environment.toWebpackConfig() +module.exports = webpackConfig diff --git a/config/webpack/environment.js b/config/webpack/environment.js deleted file mode 100644 index d16d9af74..000000000 --- a/config/webpack/environment.js +++ /dev/null @@ -1,3 +0,0 @@ -const { environment } = require('@rails/webpacker') - -module.exports = environment diff --git a/config/webpack/production.js b/config/webpack/production.js index be0f53aac..c41e04360 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -1,5 +1,5 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production' -const environment = require('./environment') +const webpackConfig = require('./base') -module.exports = environment.toWebpackConfig() +module.exports = webpackConfig diff --git a/config/webpack/test.js b/config/webpack/test.js index c5edff94a..c84a413b5 100644 --- a/config/webpack/test.js +++ b/config/webpack/test.js @@ -1,5 +1,5 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development' -const environment = require('./environment') +const webpackConfig = require('./base') -module.exports = environment.toWebpackConfig() +module.exports = webpackConfig diff --git a/config/webpacker.yml b/config/webpacker.yml index e370ef61a..3672b5707 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -1,79 +1,51 @@ # Note: You must restart bin/webpack-dev-server for changes to take effect - +--- default: &default - source_path: app/javascript - source_entry_path: packs + source_path: app/packs + source_entry_path: entrypoints public_root_path: public public_output_path: packs - cache_path: tmp/cache/webpacker - check_yarn_integrity: false - webpack_compile_output: false + cache_path: tmp/webpacker + webpack_compile_output: true - # Additional paths webpack should lookup modules + # Additional paths webpack should look up modules # ['app/assets', 'engine/foo/app/assets'] additional_paths: ['app/assets'] # Reload manifest.json on all requests so we reload latest compiled packs cache_manifest: false - # Extract and emit a css file - extract_css: true - - static_assets_extensions: - - .jpg - - .jpeg - - .png - - .gif - - .tiff - - .ico - - .svg - - .eot - - .otf - - .ttf - - .woff - - .woff2 - - extensions: - - .mjs - - .js - - .sass - - .scss - - .css - - .module.sass - - .module.scss - - .module.css - - .png - - .svg - - .gif - - .jpeg - - .jpg - development: <<: *default compile: true - # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules - check_yarn_integrity: true - # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: https: false host: localhost port: 3035 - public: localhost:3035 + # Hot Module Replacement updates modules while the application is running without a full reload hmr: false - # Inline should be set to true if using HMR - inline: true - overlay: true + # Defaults to the inverse of hmr. Uncomment to manually set this. + # live_reload: true + client: + # Should we show a full-screen overlay in the browser when there are compiler errors or warnings? + overlay: true + # May also be a string + # webSocketURL: + # hostname: "0.0.0.0" + # pathname: "/ws" + # port: 8080 + # Should we use gzip compression? compress: true - disable_host_check: true - use_local_ip: false - quiet: false + # Note that apps that do not check the host are vulnerable to DNS rebinding attacks + allowed_hosts: "all" + pretty: true headers: 'Access-Control-Allow-Origin': '*' - watch_options: - ignored: '**/node_modules/**' - + static: + watch: + ignored: '**/node_modules/**' test: <<: *default @@ -88,8 +60,5 @@ production: # Production depends on precompilation of packs prior to booting for performance. compile: false - # Extract and emit a css file - extract_css: true - # Cache manifest.json for performance cache_manifest: true diff --git a/package.json b/package.json index 32f537f29..026472d60 100644 --- a/package.json +++ b/package.json @@ -39,5 +39,8 @@ "presets": [ "./node_modules/@rails/webpacker/package/babel/preset.js" ] - } + }, + "browserslist": [ + "defaults" + ] }