diff options
| author | cedricnjanga | 2017-10-06 10:17:17 +0200 | 
|---|---|---|
| committer | cedricnjanga | 2017-10-06 10:17:17 +0200 | 
| commit | b6f08e58fae35d5dd8a610af31c2950b37746695 (patch) | |
| tree | 989843dd674c41ff73eb75bd630ce4cc91fff91b /config | |
| parent | 08517c27551a2dd8b227f6662f4c41574a36d81e (diff) | |
| download | chouette-core-b6f08e58fae35d5dd8a610af31c2950b37746695.tar.bz2 | |
Add webpacker gem and migrate the React apps
Diffstat (limited to 'config')
| -rw-r--r-- | config/application.rb | 8 | ||||
| -rw-r--r-- | config/environments/production.rb | 2 | ||||
| -rw-r--r-- | config/webpack/development.js | 3 | ||||
| -rw-r--r-- | config/webpack/environment.js | 3 | ||||
| -rw-r--r-- | config/webpack/production.js | 3 | ||||
| -rw-r--r-- | config/webpack/test.js | 3 | ||||
| -rw-r--r-- | config/webpacker.yml | 56 | 
7 files changed, 73 insertions, 5 deletions
| diff --git a/config/application.rb b/config/application.rb index 05a9752b6..169c13e10 100644 --- a/config/application.rb +++ b/config/application.rb @@ -28,7 +28,7 @@ module ChouetteIhm      config.i18n.default_locale = ENV.fetch('RAILS_LOCALE', 'fr').to_sym      # Configure Browserify to use babelify to compile ES6 -    config.browserify_rails.commandline_options = "-t [ babelify --presets [ react es2015 ] ]" +    # config.browserify_rails.commandline_options = "-t [ babelify --presets [ react es2015 ] ]"      config.active_record.observers = [:route_observer, :calendar_observer]      config.active_record.raise_in_transactional_callbacks = true @@ -40,9 +40,9 @@ module ChouetteIhm          Rails.application.config.assets.precompile += %w(spec_helper.js)          # Make sure Browserify is triggered when          # asked to serve javascript spec files -        config.browserify_rails.paths << lambda { |p| -            p.start_with?(Rails.root.join("spec/javascripts").to_s) -        } +        # config.browserify_rails.paths << lambda { |p| +        #     p.start_with?(Rails.root.join("spec/javascripts").to_s) +        # }      end    end  end diff --git a/config/environments/production.rb b/config/environments/production.rb index 794c8bd88..8e21f0919 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -144,5 +144,5 @@ Rails.application.configure do    config.rails_host = ENV.fetch('RAILS_HOST')    # Set node env for browserify-rails -  config.browserify_rails.node_env = "production" +  # config.browserify_rails.node_env = "production"  end diff --git a/config/webpack/development.js b/config/webpack/development.js new file mode 100644 index 000000000..81269f651 --- /dev/null +++ b/config/webpack/development.js @@ -0,0 +1,3 @@ +const environment = require('./environment') + +module.exports = environment.toWebpackConfig() diff --git a/config/webpack/environment.js b/config/webpack/environment.js new file mode 100644 index 000000000..d16d9af74 --- /dev/null +++ b/config/webpack/environment.js @@ -0,0 +1,3 @@ +const { environment } = require('@rails/webpacker') + +module.exports = environment diff --git a/config/webpack/production.js b/config/webpack/production.js new file mode 100644 index 000000000..81269f651 --- /dev/null +++ b/config/webpack/production.js @@ -0,0 +1,3 @@ +const environment = require('./environment') + +module.exports = environment.toWebpackConfig() diff --git a/config/webpack/test.js b/config/webpack/test.js new file mode 100644 index 000000000..81269f651 --- /dev/null +++ b/config/webpack/test.js @@ -0,0 +1,3 @@ +const environment = require('./environment') + +module.exports = environment.toWebpackConfig() diff --git a/config/webpacker.yml b/config/webpacker.yml new file mode 100644 index 000000000..e62a7acd1 --- /dev/null +++ b/config/webpacker.yml @@ -0,0 +1,56 @@ +# Note: You must restart bin/webpack-dev-server for changes to take effect + +default: &default +  source_path: app/javascript +  source_entry_path: packs +  public_output_path: packs +  cache_path: tmp/cache/webpacker + +  # Additional paths webpack should lookup modules +  # ['app/assets', 'engine/foo/app/assets'] +  resolved_paths: [] + +  # Reload manifest.json on all requests so we reload latest compiled packs +  cache_manifest: false + +  extensions: +    - .coffee +    - .erb +    - .js +    - .jsx +    - .ts +    - .vue +    - .sass +    - .scss +    - .css +    - .png +    - .svg +    - .gif +    - .jpeg +    - .jpg + +development: +  <<: *default +  compile: true + +  dev_server: +    host: localhost +    port: 3035 +    hmr: false +    https: false + +test: +  <<: *default +  compile: true + +  # Compile test packs to a separate directory +  public_output_path: packs-test + +production: +  <<: *default + +  # Production depends on precompilation of packs prior to booting for performance. +  compile: false + +  # Cache manifest.json for performance +  cache_manifest: true | 
