Skip to content

A platform for community discussion. Free, open, simple.

DEV: Enable rollup plugin compiler by default (#38658)

David Taylor74d532c55975
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index a15ea472db2..6e3f00b97df 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -24,7 +24,7 @@ permissions:
jobs:
build:
if: github.event_name == 'pull_request' || github.repository != 'discourse/discourse-private-mirror'
- name: ${{ matrix.target }} ${{ matrix.build_type }}${{ (matrix.target == 'core' && matrix.build_type == 'frontend' && format(' ({0})', matrix.browser)) || '' }}${{ matrix.plugin_compiler == 'rollup' && ' (rollup)' || '' }}
+ name: ${{ matrix.target }} ${{ matrix.build_type }}${{ (matrix.target == 'core' && matrix.build_type == 'frontend' && format(' ({0})', matrix.browser)) || '' }}${{ matrix.plugin_compiler == 'legacy' && ' (legacy)' || '' }}
runs-on: >-
${{
github.repository_owner == 'discourse' && (
@@ -71,7 +71,7 @@ jobs:
build_type: [backend, frontend, system]
target: [core, plugins, themes]
browser: [Chrome]
- plugin_compiler: ["legacy"]
+ plugin_compiler: ["rollup"]
exclude:
- build_type: backend
target: themes
@@ -91,7 +91,7 @@ jobs:
browser: Chrome
- build_type: frontend
target: plugins
- plugin_compiler: "rollup"
+ plugin_compiler: "legacy"
# - build_type: frontend
# target: core
# browser: Firefox Evergreen
diff --git a/config/pitchfork.conf.rb b/config/pitchfork.conf.rb
index 865155be92e..f4ee053c1b3 100644
--- a/config/pitchfork.conf.rb
+++ b/config/pitchfork.conf.rb
@@ -122,7 +122,7 @@ before_service_worker_ready do |server, service_worker|
demon_class.start(1, logger: server.logger)
end
- if Rails.env.development? && ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+ if Rails.env.development? && ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
Demon::PluginJsWatcher.start(verbose: true)
end
diff --git a/frontend/asset-processor/babel-replace-imports.js b/frontend/asset-processor/babel-replace-imports.js
index ba053e8d9d4..12be257cc53 100644
--- a/frontend/asset-processor/babel-replace-imports.js
+++ b/frontend/asset-processor/babel-replace-imports.js
@@ -17,7 +17,7 @@ export default function (babel) {
}
if (
- globalThis.ROLLUP_PLUGIN_COMPILER === "1" &&
+ globalThis.ROLLUP_PLUGIN_COMPILER !== "0" &&
moduleName.startsWith("discourse/plugins/")
) {
const parts = moduleName.split("/");
diff --git a/frontend/discourse-plugins/index.js b/frontend/discourse-plugins/index.js
index 1ca32fbc7e0..20ae85d1015 100644
--- a/frontend/discourse-plugins/index.js
+++ b/frontend/discourse-plugins/index.js
@@ -259,7 +259,7 @@ module.exports = {
// Matches logic from GlobalSetting.load_plugins? in the ruby app
shouldLoadPlugins() {
- if (process.env.ROLLUP_PLUGIN_COMPILER === "1") {
+ if (process.env.ROLLUP_PLUGIN_COMPILER !== "0") {
return false;
}
diff --git a/lib/discourse.rb b/lib/discourse.rb
index bfac9096d3b..4203ec39f8e 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -465,7 +465,7 @@ module Discourse
plugins.each do |plugin|
if plugin.js_asset_exists?
- if ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+ if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
if logical_path =
Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "main")
assets << {
@@ -490,7 +490,7 @@ module Discourse
end
if args[:include_admin_asset] && plugin.admin_js_asset_exists?
- if ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+ if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
if logical_path =
Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "admin")
assets << {
@@ -507,7 +507,7 @@ module Discourse
if args[:include_test_assets_for]&.include?(plugin.directory_name) &&
plugin.test_js_asset_exists?
- if ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+ if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
if logical_path =
Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "test")
assets << {
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 30391b21f50..e97765b81c2 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -24,7 +24,7 @@ task "assets:precompile:build" do
end
task "assets:precompile:build_plugins": "environment" do
- if ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+ if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
Plugin::JsManager.new.compile!
else
puts "Skipping plugin JS compilation, set ROLLUP_PLUGIN_COMPILER=1 to enable"
diff --git a/script/assemble_ember_build.rb b/script/assemble_ember_build.rb
index 609217a1b53..a7c1b4c1dca 100755
--- a/script/assemble_ember_build.rb
+++ b/script/assemble_ember_build.rb
@@ -156,7 +156,7 @@ build_cmd << "-prod" if resolved_ember_env == "production"
core_build_reusable =
existing_core_build_usable? || (download_prebuild_assets! && existing_core_build_usable?)
-if ENV["ROLLUP_PLUGIN_COMPILER"] == "1"
+if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"
if core_build_reusable
log "Reusing existing core ember build. All done."
else
diff --git a/spec/lib/discourse_spec.rb b/spec/lib/discourse_spec.rb
index f54f5313813..682c926d75e 100644
--- a/spec/lib/discourse_spec.rb
+++ b/spec/lib/discourse_spec.rb
@@ -199,14 +199,12 @@ RSpec.describe Discourse do
expect(Discourse.find_plugins(include_disabled: true)).to include(plugin1, plugin2)
end
- it "can find plugin assets" do
+ it "can find plugin css assets" do
plugin2.enabled = true
expect(Discourse.find_plugin_css_assets({}).length).to eq(2)
- expect(Discourse.find_plugin_js_assets({}).length).to eq(2)
plugin1.register_asset_filter { |type, request, opts| false }
expect(Discourse.find_plugin_css_assets({}).length).to eq(1)
- expect(Discourse.find_plugin_js_assets({}).length).to eq(1)
end
end