Skip to content
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

Update babelrc and add sourcemap to production #409

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased]


### Fixed
- Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)

Expand All @@ -13,6 +14,7 @@

- ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)


### Added
- [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
- New app: `rails new <app> --webpack=elm`
Expand All @@ -30,9 +32,33 @@
source_entry_path: packs
public_output_path: sweet/js
```

- `https` option to use `https` mode, particularly on platforms like - https://community.c9.io/t/running-a-rails-app/1615 or locally - [#176](https://github.com/rails/webpacker/issues/176)

- [Babel] Dynamic import() and Class Fields and Static Properties babel plugin to `.babelrc`

```json
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],

"plugins": [
"syntax-dynamic-import",
"transform-class-properties", { "spec": true }
]
}
```

- Source-map support for production bundle


#### Breaking Change

Expand All @@ -57,6 +83,7 @@ bundle update webpacker
bundle exec rails webpacker:install
```


### Fixed
- Support Spring - [#205](https://github.com/rails/webpacker/issues/205)

Expand All @@ -75,6 +102,7 @@ bundle exec rails webpacker:install

- Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)


### Added
- A changelog - [#211](https://github.com/rails/webpacker/issues/211)
- Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
Expand All @@ -91,16 +119,19 @@ bundle exec rails webpacker:install
- Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
- Compile assets before test:controllers and test:system


### Removed
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)


## [1.1] - 2017-03-24

This release requires you to run below commands to install new features.

```
bundle update webpacker
bundle exec rails webpacker:install

# if installed react, vue or angular
bundle exec rails webpacker:install:[react, angular, vue]
```
Expand All @@ -109,6 +140,7 @@ bundle exec rails webpacker:install:[react, angular, vue]
- Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
- Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)


### Removed

```rb
Expand Down
5 changes: 5 additions & 0 deletions lib/install/config/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
},
"useBuiltIns": true
}]
],

"plugins": [
"syntax-dynamic-import",
["transform-class-properties", { "spec": true }]
]
}
16 changes: 15 additions & 1 deletion lib/install/config/webpack/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,23 @@ const sharedConfig = require('./shared.js')

module.exports = merge(sharedConfig, {
output: { filename: '[name]-[chunkhash].js' },
devtool: 'source-map',
stats: 'normal',

plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
sourceMap: true,

compress: {
warnings: false
},

output: {
comments: false
}
}),

new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
Expand Down
1 change: 1 addition & 0 deletions lib/install/examples/angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"exclude": [
"**/*.spec.ts",
"node_modules",
"vendor",
"public"
],
"compileOnSave": false
Expand Down
15 changes: 6 additions & 9 deletions lib/install/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
directory "#{__dir__}/config/webpack", "config/webpack"
directory "#{__dir__}/config/loaders/core", "config/webpack/loaders"

unless File.exist?(".postcssrc.yml")
puts "Copying .postcssrc.yml to app root directory"
copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
end
puts "Copying .postcssrc.yml to app root directory"
copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"

unless File.exist?(".babelrc")
puts "Copying .babelrc to app root directory"
copy_file "#{__dir__}/config/.babelrc", ".babelrc"
end
puts "Copying .babelrc to app root directory"
copy_file "#{__dir__}/config/.babelrc", ".babelrc"

puts "Creating javascript app source directory"
directory "#{__dir__}/javascript", "#{Webpacker::Configuration.source}"
Expand All @@ -35,7 +31,8 @@
"webpack-manifest-plugin [email protected] coffee-loader coffee-script " \
"babel-core babel-preset-env babel-polyfill compression-webpack-plugin rails-erb-loader glob " \
"extract-text-webpack-plugin node-sass file-loader sass-loader css-loader style-loader " \
"postcss-loader autoprefixer postcss-smart-import precss resolve-url-loader"
"postcss-loader autoprefixer postcss-smart-import precss resolve-url-loader " \
"babel-plugin-syntax-dynamic-import babel-plugin-transform-class-properties"

puts "Installing dev server for live reloading"
run "yarn add --dev webpack-dev-server"
Expand Down