Skip to content

Commit

Permalink
rails webpacker:install check again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Jan 11, 2022
1 parent ea2bf82 commit 8aafe3e
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 83 deletions.
11 changes: 4 additions & 7 deletions bin/webpack
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/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"

ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
Expand Down
5 changes: 3 additions & 2 deletions bin/yarn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
select { |dir| File.expand_path(dir) != __dir__ }.
product(["yarn", "yarn.cmd", "yarn.ps1"]).
product(["yarn", "yarnpkg", "yarn.cmd", "yarn.ps1"]).
map { |dir, file| File.expand_path(file, dir) }.
find { |file| File.executable?(file) }

Expand Down
3 changes: 3 additions & 0 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

# Rails.application.config.content_security_policy do |policy|
# # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?

# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
Expand Down
9 changes: 2 additions & 7 deletions config/webpack/base.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
const { webpackConfig, merge } = require('@rails/webpacker')
const customConfig = {
resolve: {
extensions: ['.css']
}
}
const { webpackConfig } = require('@rails/webpacker')

module.exports = merge(webpackConfig, customConfig)
module.exports = webpackConfig
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
},
"devDependencies": {
"@webpack-cli/serve": "^1.6.0",
"typescript": "^3.9.10",
"webpack-dev-server": "^4.7.1"
},
"resolutions": {
"chokidar": "^3.5.2"
},
Expand All @@ -42,5 +37,10 @@
},
"browserslist": [
"defaults"
]
],
"devDependencies": {
"@webpack-cli/serve": "^1.6.0",
"typescript": "^3.9.10",
"webpack-dev-server": "^4.7.2"
}
}
Loading

0 comments on commit 8aafe3e

Please sign in to comment.