Sha256: 5b0478a69b294b12c2355dfa51b847e995974ed0e61ed57b98de649e117ff9a1
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
<%= shebang %> $stdout.sync = true require "shellwords" require "yaml" ENV["RAILS_ENV"] ||= "development" RAILS_ENV = ENV["RAILS_ENV"] ENV["NODE_ENV"] ||= RAILS_ENV NODE_ENV = ENV["NODE_ENV"] APP_PATH = File.expand_path("../", File.dirname(__FILE__)) CONFIG_FILE = File.join(APP_PATH, "config/webpacker.yml") NODE_MODULES_PATH = File.join(APP_PATH, "node_modules") WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/development.js") def args(key) index = ARGV.index(key) index ? ARGV[index + 1] : nil end begin dev_server = YAML.load_file(CONFIG_FILE)["development"]["dev_server"] DEV_SERVER_HOST = "http#{"s" if args('--https') || dev_server["https"]}://#{args('--host') || dev_server["host"]}:#{args('--port') || dev_server["port"]}" rescue Errno::ENOENT, NoMethodError puts "Webpack dev_server configuration not found in #{CONFIG_FILE}." puts "Please run bundle exec rails webpacker:install to install webpacker" exit! end newenv = { "NODE_PATH" => NODE_MODULES_PATH.shellescape, "ASSET_HOST" => DEV_SERVER_HOST.shellescape }.freeze cmdline = ["yarn", "run", "webpack-dev-server", "--", "--progress", "--color", "--config", WEBPACK_CONFIG] + ARGV Dir.chdir(APP_PATH) do exec newenv, *cmdline end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webpacker-legacy-0.1.2 | lib/install/bin/webpack-dev-server.tt |
webpacker-legacy-0.1.1 | lib/install/bin/webpack-dev-server.tt |
webpacker-legacy-0.1.0 | lib/install/bin/webpack-dev-server.tt |