Browse Source

Switch to JSBundling with webpack

jsbundling-with-webpack-modernizr
baarkerlounger 3 years ago
parent
commit
6547396152
  1. 3
      .gitignore
  2. 6
      Gemfile
  3. 18
      Gemfile.lock
  4. 2
      Procfile.dev
  5. 0
      app/assets/builds/.keep
  6. 1
      app/assets/config/manifest.js
  7. 7
      app/frontend/active_admin.js
  8. 13
      app/frontend/application.js
  9. 0
      app/frontend/channels/consumer.js
  10. 0
      app/frontend/channels/index.js
  11. 0
      app/frontend/controllers/accessible_autocomplete_controller.js
  12. 0
      app/frontend/controllers/application.js
  13. 0
      app/frontend/controllers/conditional_question_controller.js
  14. 0
      app/frontend/controllers/govukfrontend_controller.js
  15. 19
      app/frontend/controllers/index.js
  16. 0
      app/frontend/controllers/numeric_question_controller.js
  17. 0
      app/frontend/controllers/tasklist_controller.js
  18. 2
      app/frontend/entrypoints/active_admin.js
  19. 6
      app/frontend/entrypoints/application.js
  20. 0
      app/frontend/styles/_accessible-autocomplete.scss
  21. 0
      app/frontend/styles/_button.scss
  22. 0
      app/frontend/styles/_figure.scss
  23. 0
      app/frontend/styles/_input.scss
  24. 0
      app/frontend/styles/_panel.scss
  25. 0
      app/frontend/styles/_related-navigation.scss
  26. 0
      app/frontend/styles/_section-skip-link.scss
  27. 0
      app/frontend/styles/_tab-navigation.scss
  28. 0
      app/frontend/styles/_table-group.scss
  29. 0
      app/frontend/styles/_task-list.scss
  30. 0
      app/frontend/styles/_template.scss
  31. 4
      app/frontend/styles/active_admin.scss
  32. 0
      app/frontend/styles/application.scss
  33. 18
      app/views/layouts/application.html.erb
  34. 9
      app/webpacker/controllers/index.js
  35. 9
      bin/dev
  36. 18
      bin/webpack
  37. 18
      bin/webpack-dev-server
  38. 9
      config/initializers/active_admin.rb
  39. 5
      config/webpack/development.js
  40. 5
      config/webpack/environment.js
  41. 7
      config/webpack/plugins/jquery.js
  42. 5
      config/webpack/production.js
  43. 5
      config/webpack/staging.js
  44. 5
      config/webpack/test.js
  45. 102
      config/webpacker.yml
  46. 34
      package.json
  47. 66
      webpack.config.js
  48. 5641
      yarn.lock

3
.gitignore vendored

@ -46,3 +46,6 @@ yarn-debug.log*
.DS_Store .DS_Store
.generators .generators
.rakeTasks .rakeTasks
/app/assets/builds/*
!/app/assets/builds/.keep

6
Gemfile

@ -11,8 +11,10 @@ gem "rails", "~> 7.0.2"
gem "pg", "~> 1.1" gem "pg", "~> 1.1"
# Use Puma as the app server # Use Puma as the app server
gem "puma", "~> 5.0" gem "puma", "~> 5.0"
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker # The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "webpacker", "~> 5.0" gem "propshaft"
# Bundle and transpile JavaScript [https://github.com/rails/propshaft/]
gem "jsbundling-rails"
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", ">= 1.4.4", require: false gem "bootsnap", ">= 1.4.4", require: false
# GOV UK frontend components # GOV UK frontend components

18
Gemfile.lock

@ -203,6 +203,8 @@ GEM
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jsbundling-rails (1.0.2)
railties (>= 6.0.0)
json-schema (2.8.1) json-schema (2.8.1)
addressable (>= 2.4) addressable (>= 2.4)
jwt (2.3.0) jwt (2.3.0)
@ -273,6 +275,11 @@ GEM
pg (1.3.4) pg (1.3.4)
postcodes_io (0.4.0) postcodes_io (0.4.0)
excon (~> 0.39) excon (~> 0.39)
propshaft (0.6.4)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.13.1) pry (0.13.1)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
@ -288,8 +295,6 @@ GEM
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-mini-profiler (2.3.4) rack-mini-profiler (2.3.4)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-proxy (0.7.2)
rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (7.0.2.3) rails (7.0.2.3)
@ -401,7 +406,6 @@ GEM
childprocess (>= 0.5, < 5.0) childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2) rubyzip (>= 1.2.2)
semantic_range (3.0.0)
sentry-rails (5.2.0) sentry-rails (5.2.0)
railties (>= 5.0) railties (>= 5.0)
sentry-ruby-core (~> 5.2.0) sentry-ruby-core (~> 5.2.0)
@ -443,11 +447,6 @@ GEM
addressable (>= 2.8.0) addressable (>= 2.8.0)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.4.3)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.5) websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
@ -477,6 +476,7 @@ DEPENDENCIES
govuk-components govuk-components
govuk_design_system_formbuilder govuk_design_system_formbuilder
hotwire-rails hotwire-rails
jsbundling-rails
json-schema json-schema
listen (~> 3.3) listen (~> 3.3)
notifications-ruby-client notifications-ruby-client
@ -485,6 +485,7 @@ DEPENDENCIES
paper_trail-globalid paper_trail-globalid
pg (~> 1.1) pg (~> 1.1)
postcodes_io postcodes_io
propshaft
pry-byebug pry-byebug
puma (~> 5.0) puma (~> 5.0)
rack-attack rack-attack
@ -508,7 +509,6 @@ DEPENDENCIES
view_component view_component
web-console (>= 4.1.0) web-console (>= 4.1.0)
webmock webmock
webpacker (~> 5.0)
RUBY VERSION RUBY VERSION
ruby 3.1.1p18 ruby 3.1.1p18

2
Procfile.dev

@ -0,0 +1,2 @@
web: bin/rails server -p 3000
js: yarn build --watch

0
app/assets/builds/.keep

1
app/assets/config/manifest.js

@ -0,0 +1 @@
//= link_tree ../builds

7
app/frontend/active_admin.js

@ -0,0 +1,7 @@
// Load Active Admin's styles into Webpacker,
// see `active_admin.scss` for customization.
import "./styles/active_admin.scss";
import "@activeadmin/activeadmin";
import "chartkick/chart.js"

13
app/frontend/application.js

@ -0,0 +1,13 @@
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require.context("govuk-frontend/govuk/assets")
import "./styles/application.scss"
import "./controllers"
import "@hotwired/turbo-rails"
import { initAll } from "govuk-frontend"
ActiveStorage.start()
initAll()

0
app/webpacker/channels/consumer.js → app/frontend/channels/consumer.js

0
app/webpacker/channels/index.js → app/frontend/channels/index.js

0
app/webpacker/controllers/accessible_autocomplete_controller.js → app/frontend/controllers/accessible_autocomplete_controller.js

0
app/webpacker/controllers/application.js → app/frontend/controllers/application.js

0
app/webpacker/controllers/conditional_question_controller.js → app/frontend/controllers/conditional_question_controller.js

0
app/webpacker/controllers/govukfrontend_controller.js → app/frontend/controllers/govukfrontend_controller.js

19
app/frontend/controllers/index.js

@ -0,0 +1,19 @@
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { application } from "./application"
import AccessibleAutocompleteController from "./accessible_autocomplete_controller.js"
application.register("accessible-autocomplete", AccessibleAutocompleteController)
import ConditionalQuestionController from "./conditional_question_controller.js"
application.register("conditional-question", ConditionalQuestionController)
import GovukfrontendController from "./govukfrontend_controller.js"
application.register("govukfrontend", GovukfrontendController)
import NumericQuestionController from "./numeric_question_controller.js"
application.register("numeric-question", NumericQuestionController)
import TasklistController from "./tasklist_controller.js"
application.register("tasklist", TasklistController)

0
app/webpacker/controllers/numeric_question_controller.js → app/frontend/controllers/numeric_question_controller.js

0
app/webpacker/controllers/tasklist_controller.js → app/frontend/controllers/tasklist_controller.js

2
app/webpacker/packs/active_admin.js → app/frontend/entrypoints/active_admin.js

@ -1,6 +1,6 @@
// Load Active Admin's styles into Webpacker, // Load Active Admin's styles into Webpacker,
// see `active_admin.scss` for customization. // see `active_admin.scss` for customization.
import "../styles/active_admin"; import "styles/active_admin.scss";
import "@activeadmin/activeadmin"; import "@activeadmin/activeadmin";

6
app/webpacker/packs/application.js → app/frontend/entrypoints/application.js

@ -2,14 +2,14 @@
// present in this directory. You're encouraged to place your actual application logic in // present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference // a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled. // that code so it'll be compiled.
require.context('govuk-frontend/govuk/assets') require.context("govuk-frontend/govuk/assets")
import '../styles/application.scss' import "styles/application.scss"
import * as ActiveStorage from "@rails/activestorage" import * as ActiveStorage from "@rails/activestorage"
import "channels" import "channels"
import "controllers" import "controllers"
import "@hotwired/turbo-rails" import "@hotwired/turbo-rails"
import { initAll } from 'govuk-frontend' import { initAll } from "govuk-frontend"
ActiveStorage.start() ActiveStorage.start()
initAll() initAll()

0
app/webpacker/styles/_accessible-autocomplete.scss → app/frontend/styles/_accessible-autocomplete.scss

0
app/webpacker/styles/_button.scss → app/frontend/styles/_button.scss

0
app/webpacker/styles/_figure.scss → app/frontend/styles/_figure.scss

0
app/webpacker/styles/_input.scss → app/frontend/styles/_input.scss

0
app/webpacker/styles/_panel.scss → app/frontend/styles/_panel.scss

0
app/webpacker/styles/_related-navigation.scss → app/frontend/styles/_related-navigation.scss

0
app/webpacker/styles/_section-skip-link.scss → app/frontend/styles/_section-skip-link.scss

0
app/webpacker/styles/_tab-navigation.scss → app/frontend/styles/_tab-navigation.scss

0
app/webpacker/styles/_table-group.scss → app/frontend/styles/_table-group.scss

0
app/webpacker/styles/_task-list.scss → app/frontend/styles/_task-list.scss

0
app/webpacker/styles/_template.scss → app/frontend/styles/_template.scss

4
app/webpacker/styles/active_admin.scss → app/frontend/styles/active_admin.scss

@ -8,8 +8,8 @@
// $sidebar-width: 242px; // $sidebar-width: 242px;
// Active Admin's got SASS! // Active Admin's got SASS!
@import "~@activeadmin/activeadmin/src/scss/mixins"; @import "@activeadmin/activeadmin/src/scss/mixins";
@import "~@activeadmin/activeadmin/src/scss/base"; @import "@activeadmin/activeadmin/src/scss/base";
// Overriding any non-variable Sass must be done after the fact. // Overriding any non-variable Sass must be done after the fact.
// For example, to change the default status-tag color: // For example, to change the default status-tag color:

0
app/webpacker/styles/application.scss → app/frontend/styles/application.scss

18
app/views/layouts/application.html.erb

@ -5,16 +5,16 @@
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %>
<%= tag :meta, property: 'og:image', content: asset_pack_path('media/images/govuk-opengraph-image.png') %> <%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %>
<%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %>
<%= favicon_link_tag asset_pack_path('media/images/favicon.ico') %> <%= favicon_link_tag asset_path('images/favicon.ico') %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %>
<%= stylesheet_pack_tag 'application', media: 'all' %> <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_pack_tag 'application', defer: true %> <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
<% if content_for?(:head) %> <% if content_for?(:head) %>
<%= yield(:head) %> <%= yield(:head) %>

9
app/webpacker/controllers/index.js

@ -1,9 +0,0 @@
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { Application } from "@hotwired/stimulus"
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"
const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))

9
bin/dev

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if ! command -v foreman &> /dev/null
then
echo "Installing foreman..."
gem install foreman
fi
foreman start -f Procfile.dev "$@"

18
bin/webpack

@ -1,18 +0,0 @@
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "bundler/setup"
require "webpacker"
require "webpacker/webpack_runner"
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
end

18
bin/webpack-dev-server

@ -1,18 +0,0 @@
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "bundler/setup"
require "webpacker"
require "webpacker/dev_server_runner"
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::DevServerRunner.run(ARGV)
end

9
config/initializers/active_admin.rb

@ -331,14 +331,7 @@ ActiveAdmin.setup do |config|
# By default, Active Admin uses Sprocket's asset pipeline. # By default, Active Admin uses Sprocket's asset pipeline.
# You can switch to using Webpacker here. # You can switch to using Webpacker here.
# #
config.use_webpacker = true # config.use_webpacker = true
end
# Print stylesheet is no longer a separate stylesheet in upstream so we can
# delete this when the next version bump is released but for now it prevents
# webpacker issues.
Rails.application.config.after_initialize do
ActiveAdmin.application.stylesheets.delete("active_admin/print.css")
end end
Rails.application.config.after_initialize do Rails.application.config.after_initialize do

5
config/webpack/development.js

@ -1,5 +0,0 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

5
config/webpack/environment.js

@ -1,5 +0,0 @@
const { environment } = require('@rails/webpacker')
const jquery = require('./plugins/jquery')
environment.plugins.prepend('jquery', jquery)
module.exports = environment

7
config/webpack/plugins/jquery.js vendored

@ -1,7 +0,0 @@
const webpack = require('webpack')
module.exports = new webpack.ProvidePlugin({
"$":"jquery",
"jQuery":"jquery",
"window.jQuery":"jquery"
});

5
config/webpack/production.js

@ -1,5 +0,0 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

5
config/webpack/staging.js

@ -1,5 +0,0 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'staging'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

5
config/webpack/test.js

@ -1,5 +0,0 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

102
config/webpacker.yml

@ -1,102 +0,0 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/webpacker
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
webpack_compile_output: true
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
additional_paths: ['node_modules/govuk-frontend/govuk']
# Cache manifest.json for performance
cache_manifest: true
# Extract and emit a css file
extract_css: true
# Production depends on precompilation of packs prior to booting for performance.
compile: false
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
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
# Extract and emit a css file
extract_css: false
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: false
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: '**/node_modules/**'
test:
<<: *default
compile: true
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
# Extract and emit a css file
extract_css: false
# Compile test packs to a separate directory
public_output_path: packs-test
staging:
<<: *default
production:
<<: *default

34
package.json

@ -5,28 +5,38 @@
"node": "^16.0.0" "node": "^16.0.0"
}, },
"dependencies": { "dependencies": {
"@activeadmin/activeadmin": "^2.9.0", "@activeadmin/activeadmin": "^2.11.0",
"@babel/core": "^7.17.7",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@hotwired/stimulus": "^3.0.0", "@hotwired/stimulus": "^3.0.0",
"@hotwired/stimulus-webpack-helpers": "^1.0.1",
"@hotwired/turbo": "^7.1.0", "@hotwired/turbo": "^7.1.0",
"@hotwired/turbo-rails": "^7.1.0", "@hotwired/turbo-rails": "^7.1.0",
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/webpacker": "5.4.3",
"accessible-autocomplete": "^2.0.3", "accessible-autocomplete": "^2.0.3",
"babel-loader": "^8.2.3",
"babel-plugin-macros": "^3.1.0",
"chart.js": "^3.6.0", "chart.js": "^3.6.0",
"chartkick": "^4.1.0", "chartkick": "^4.1.0",
"copy-webpack-plugin": "^10.2.4",
"css-loader": "^6.7.1",
"file-loader": "^6.2.0",
"govuk-frontend": "^4.0.1", "govuk-frontend": "^4.0.1",
"mini-css-extract-plugin": "^2.6.0",
"sass": "^1.49.9",
"sass-loader": "^12.6.0",
"stimulus": "^3.0.0", "stimulus": "^3.0.0",
"webpack": "^4.46.0", "webpack": "^5.70.0",
"webpack-cli": "^4.9.2" "webpack-cli": "^4.9.2",
"webpack-remove-empty-scripts": "^0.7.3"
}, },
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {},
"webpack-dev-server": "^4.7.4" "babel": {
"presets": [
"@babel/preset-env"
]
}, },
"resolutions": { "scripts": {
"glob-parent": "^6.0.2", "build": "webpack --config webpack.config.js"
"nth-check": "^2.0.1"
} }
} }

66
webpack.config.js

@ -0,0 +1,66 @@
const path = require("path")
const webpack = require("webpack")
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts')
const CopyPlugin = require("copy-webpack-plugin");
const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production'
module.exports = {
mode,
optimization: {
moduleIds: 'deterministic'
},
devtool: "source-map",
entry: {
application: [
"./app/frontend/application.js",
],
active_admin:[
'./app/frontend/active_admin.js',
'./app/frontend/styles/active_admin.scss'
]
},
module: {
rules: [
{
test: /\.(js)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(png|jpe?g|gif|eot|woff2|woff|ttf|svg|ico)$/i,
use: 'file-loader',
},
{
test: /\.(scss|css)/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
}
],
},
resolve: {
modules: ['node_modules', 'node_modules/govuk-frontend/govuk']
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "app/assets/builds"),
},
plugins: [
new RemoveEmptyScriptsPlugin(),
new MiniCssExtractPlugin(),
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
new CopyPlugin({
patterns: [
{ from: "node_modules/govuk-frontend/govuk/assets/images", to: "images" },
{ from: "node_modules/govuk-frontend/govuk/assets/fonts", to: "fonts" },
],
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery'
})
]
}

5641
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save