-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate .yml files into webpacker.yml #403
Changes from 8 commits
dc1e539
eaa5056
f03ed31
c877358
af4be41
58c428d
1702466
099f080
a60d569
32f18cd
91c6c7b
abc53ac
37706a9
f76db0e
1140244
f992607
5e363f3
bb19d26
6cdf5d0
57e082c
3046503
9d3288a
bfab985
c030cf9
6b60766
6cc0600
57e7ecf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,30 @@ | |
|
||
const merge = require('webpack-merge') | ||
const sharedConfig = require('./shared.js') | ||
const { dev_server, output } = require('./configuration.js') | ||
|
||
module.exports = merge(sharedConfig, { | ||
devtool: 'sourcemap', | ||
devtool: 'cheap-module-source-map', | ||
|
||
stats: { | ||
errorDetails: true | ||
}, | ||
|
||
output: { | ||
pathinfo: true | ||
}, | ||
|
||
devServer: { | ||
clientLogLevel: 'none', | ||
host: dev_server.host, | ||
port: dev_server.port, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh it was there, will fix 👍 |
||
contentBase: output.path, | ||
publicPath: output.publicPath, | ||
compress: true, | ||
headers: { 'Access-Control-Allow-Origin': '*' }, | ||
historyApiFallback: true, | ||
watchOptions: { | ||
ignored: /node_modules/ | ||
} | ||
} | ||
}) |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Note: You must restart bin/webpack-dev-server for changes to take effect | ||
|
||
default: &default | ||
dev_server: # https://webpack.js.org/configuration/dev-server/ | ||
host: localhost # Dev server host | ||
port: 8080 | ||
https: false | ||
|
||
paths: # ~ = Rails.root | ||
source: app/javascript # ~/:source | ||
entry: packs # ~/:source/:entry | ||
output: packs # ~/public/:output | ||
manifest: manifest.json # ~/public/:output/:manifest | ||
config: config/webpack # ~/:config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to propose a flattened set of options that drops source_path: app/javascript
source_entry_path: packs
public_output_path: packs In doing so, we'd drop the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense and since the output directory can be modified the manifest can remain same 👍 Yep, was thinking same for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In regards to removing paths, I feel it's much nicer to keep it under some namespace like we have for dev-server - keeps it consistent and clean. WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, we should probably flatten all of the namespaces. They don't merge into the environments like you'd expect: >> config = YAML.load_file("webpacker.yml")
>> config["default"]["paths"]
=> {"source"=>"app/javascript", "entry"=>"packs", "output"=>"packs", "manifest"=>"manifest.json", "config"=>"config/webpack"}
>> config["test"]["paths"]
=> {"output"=>"packs-test"} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the dev server options should be flattened to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yepp, that would work 👍 Although a bit repetitive and verbose if we start to have many options, especially for the dev server - default: &default
dev_server_host: localhost
dev_server_port: 8080
dev_server_https: false
dev_server_hot: false
source_path: app/javascript
source_entry_path: packs
public_output_path: packs VS default: &default
dev_server: # https://webpack.js.org/configuration/dev-server/
host: localhost # Dev server host
port: 8080
https: false
hot: false
paths: # ~ = Rails.root
source: app/javascript # ~/:source
entry: packs # ~/:source/:entry
output: packs # ~/public/:output There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The more important part is that those namespaces won't work if you want to change part of them in an environment. For example: >> config = YAML.load("
default: &default
paths:
source: app/javascript
entry: packs
output: packs
production:
<<: *default
paths:
output: foo
")
=> {"default"=>{"paths"=>{"source"=>"app/javascript", "entry"=>"packs", "output"=>"packs"}}, "production"=>{"paths"=>{"output"=>"foo"}}}
>> config["production"]["paths"]["source"]
=> nil
>> config["production"]["paths"]["entry"]
=> nil
>> config["production"]["paths"]["output"]
=> "foo" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh I see 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this ? # Note: You must restart bin/webpack-dev-server for changes to take effect
dev_server_defaults: &dev_server_defaults # https://webpack.js.org/configuration/dev-server/
host: localhost # Dev server host
port: 8080
https: false
paths_defaults: &paths_defaults # ~ = Rails.root
source: app/javascript # ~/:source
entry: packs # ~/:source/:entry
output: packs # ~/public/:output
default: &default
dev_server:
<<: *dev_server_defaults
paths:
<<: *paths_defaults
extensions:
- .coffee
- .js
- .jsx
- .ts
- .vue
- .sass
- .scss
- .css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
test:
<<: *default
paths:
<<: *paths_defaults
output: packs-test
production:
<<: *default
dev_server:
<<: *dev_server_defaults
host: 0.0.0.0 # Cloud9
port: 8080
https: true
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking again - feels like it will be much better if we just flatten it 👍 |
||
|
||
extensions: | ||
- .coffee | ||
- .js | ||
- .jsx | ||
- .ts | ||
- .vue | ||
- .sass | ||
- .scss | ||
- .css | ||
- .png | ||
- .svg | ||
- .gif | ||
- .jpeg | ||
- .jpg | ||
|
||
development: | ||
<<: *default | ||
|
||
test: | ||
<<: *default | ||
|
||
paths: | ||
output: packs-test | ||
|
||
production: | ||
<<: *default | ||
|
||
dev_server: | ||
host: 0.0.0.0 # Cloud9 | ||
port: 8080 | ||
https: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for adding this? Seems like it's encouraging use in production. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some folks are using custom domain + https. Perhaps, I will change this to a dev domain. Related to #319 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #319 is about using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh yes my bad, mixed it up with this one - #176. Changed it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still don't think we should provide any different |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a necessary change or just better source map option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommended
source map
option in development