diff --git a/examples/webpack-per-file-issue/README.md b/examples/webpack-per-file-issue/README.md new file mode 100644 index 00000000..5636eab8 --- /dev/null +++ b/examples/webpack-per-file-issue/README.md @@ -0,0 +1,11 @@ +This addresses an issue with `per-file` compilation with Webpack + +1. Just run + +```shell +./gradlew build +``` + +2. Change "CUSTOM TEXT" from `Main.kt` to something else +3. Rebuild +4. See that compileSync file differs from the `dist` diff --git a/examples/webpack-per-file-issue/build.gradle.kts b/examples/webpack-per-file-issue/build.gradle.kts new file mode 100644 index 00000000..f265e07b --- /dev/null +++ b/examples/webpack-per-file-issue/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + alias(kfc.plugins.application) +} diff --git a/examples/webpack-per-file-issue/gradle.properties b/examples/webpack-per-file-issue/gradle.properties new file mode 100644 index 00000000..529e148d --- /dev/null +++ b/examples/webpack-per-file-issue/gradle.properties @@ -0,0 +1,2 @@ +kfc.module.name=webpack-per-file-issue +kfc.bundler=webpack diff --git a/examples/webpack-per-file-issue/src/jsMain/kotlin/Main.kt b/examples/webpack-per-file-issue/src/jsMain/kotlin/Main.kt new file mode 100644 index 00000000..94da9733 --- /dev/null +++ b/examples/webpack-per-file-issue/src/jsMain/kotlin/Main.kt @@ -0,0 +1,3 @@ +private fun main() { + SomeModule("CUSTOM TEXT") +} diff --git a/examples/webpack-per-file-issue/src/jsMain/kotlin/SomeModule.kt b/examples/webpack-per-file-issue/src/jsMain/kotlin/SomeModule.kt new file mode 100644 index 00000000..78d9d4af --- /dev/null +++ b/examples/webpack-per-file-issue/src/jsMain/kotlin/SomeModule.kt @@ -0,0 +1 @@ +class SomeModule(val value: String) diff --git a/package-lock.json b/package-lock.json index dfca65c8..09f528d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,8 @@ "packages/kfc-plugins-gradle-plugin-test-test", "packages/kfc-plugins-js-plain-object", "packages/kfc-plugins-js-plain-object-test", + "packages/webpack-per-file-issue", + "packages/webpack-per-file-issue-test", "packages/assets-lib", "packages/assets-lib-test", "packages/assets-lib-multiplatform", @@ -2876,14 +2878,26 @@ "resolved": "packages/kfc-plugins-lib-a", "link": true }, + "node_modules/kfc-plugins-lib-a-test": { + "resolved": "packages/kfc-plugins-lib-a-test", + "link": true + }, "node_modules/kfc-plugins-lib-b": { "resolved": "packages/kfc-plugins-lib-b", "link": true }, + "node_modules/kfc-plugins-lib-b-test": { + "resolved": "packages/kfc-plugins-lib-b-test", + "link": true + }, "node_modules/kfc-plugins-lib-c": { "resolved": "packages/kfc-plugins-lib-c", "link": true }, + "node_modules/kfc-plugins-lib-c-test": { + "resolved": "packages/kfc-plugins-lib-c-test", + "link": true + }, "node_modules/kfc-plugins-second": { "resolved": "packages/kfc-plugins-second", "link": true @@ -3975,14 +3989,26 @@ "resolved": "packages/simple-library", "link": true }, + "node_modules/simple-library-test": { + "resolved": "packages/simple-library-test", + "link": true + }, "node_modules/simple-vite-app": { "resolved": "packages/simple-vite-app", "link": true }, + "node_modules/simple-vite-app-test": { + "resolved": "packages/simple-vite-app-test", + "link": true + }, "node_modules/simple-webpack-app": { "resolved": "packages/simple-webpack-app", "link": true }, + "node_modules/simple-webpack-app-test": { + "resolved": "packages/simple-webpack-app-test", + "link": true + }, "node_modules/socket.io": { "version": "4.7.5", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.5.tgz", @@ -4608,6 +4634,10 @@ "resolved": "packages/vite-custom-config", "link": true }, + "node_modules/vite-custom-config-test": { + "resolved": "packages/vite-custom-config-test", + "link": true + }, "node_modules/void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", @@ -4760,6 +4790,10 @@ "lodash": "^4.17.15" } }, + "node_modules/webpack-per-file-issue": { + "resolved": "packages/webpack-per-file-issue", + "link": true + }, "node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", @@ -4794,6 +4828,10 @@ "resolved": "packages/wl-worker", "link": true }, + "node_modules/wl-worker-test": { + "resolved": "packages/wl-worker-test", + "link": true + }, "node_modules/workerpool": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", @@ -4852,14 +4890,26 @@ "resolved": "packages/ww-entity", "link": true }, + "node_modules/ww-entity-test": { + "resolved": "packages/ww-entity-test", + "link": true + }, "node_modules/ww-local-server": { "resolved": "packages/ww-local-server", "link": true }, + "node_modules/ww-local-server-test": { + "resolved": "packages/ww-local-server-test", + "link": true + }, "node_modules/ww-view-wl": { "resolved": "packages/ww-view-wl", "link": true }, + "node_modules/ww-view-wl-test": { + "resolved": "packages/ww-view-wl-test", + "link": true + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -5106,6 +5156,24 @@ }, "devDependencies": {} }, + "packages/kfc-plugins-lib-a-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/kfc-plugins-lib-b": { "version": "0.0.0-unspecified", "dependencies": { @@ -5113,6 +5181,24 @@ }, "devDependencies": {} }, + "packages/kfc-plugins-lib-b-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/kfc-plugins-lib-c": { "version": "0.0.0-unspecified", "dependencies": { @@ -5121,6 +5207,25 @@ }, "devDependencies": {} }, + "packages/kfc-plugins-lib-c-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "@preact/signals-core": "1.8.0", + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/kfc-plugins-second": { "version": "0.0.0-unspecified", "dependencies": { @@ -5153,6 +5258,24 @@ }, "devDependencies": {} }, + "packages/simple-library-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/simple-vite-app": { "version": "0.0.0-unspecified", "dependencies": { @@ -5163,6 +5286,24 @@ "vite": "5.4.6" } }, + "packages/simple-vite-app-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/simple-webpack-app": { "version": "0.0.0-unspecified", "dependencies": { @@ -5176,6 +5317,26 @@ "webpack-cli": "5.1.4" } }, + "packages/simple-webpack-app-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "css-loader": "7.1.2", + "file-loader": "6.2.0", + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/vite-custom-config": { "version": "0.0.0-unspecified", "dependencies": { @@ -5186,6 +5347,37 @@ "vite": "5.4.6" } }, + "packages/vite-custom-config-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, + "packages/webpack-per-file-issue": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "css-loader": "7.1.2", + "file-loader": "6.2.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/wl-worker": { "version": "0.0.0-unspecified", "dependencies": { @@ -5195,6 +5387,24 @@ "typescript": "5.5.4" } }, + "packages/wl-worker-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/ww-entity": { "version": "0.0.0-unspecified", "dependencies": { @@ -5202,6 +5412,24 @@ }, "devDependencies": {} }, + "packages/ww-entity-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/ww-local-server": { "version": "0.0.0-unspecified", "dependencies": { @@ -5212,6 +5440,24 @@ "vite": "5.4.6" } }, + "packages/ww-local-server-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } + }, "packages/ww-view-wl": { "version": "0.0.0-unspecified", "dependencies": { @@ -5221,6 +5467,24 @@ "typescript": "5.5.4", "vite": "5.4.6" } + }, + "packages/ww-view-wl-test": { + "version": "0.0.0-unspecified", + "dependencies": { + "format-util": "^1.0.5" + }, + "devDependencies": { + "karma": "6.4.4", + "karma-chrome-launcher": "3.2.0", + "karma-mocha": "2.0.1", + "karma-sourcemap-loader": "0.4.0", + "karma-webpack": "5.0.1", + "mocha": "10.7.0", + "source-map-loader": "5.0.0", + "typescript": "5.5.4", + "webpack": "5.94.0", + "webpack-cli": "5.1.4" + } } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 4c410450..4e01ac54 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -55,6 +55,8 @@ include("examples:vite:simple-library") include("examples:vite:simple-vite-app") include("examples:vite:simple-webpack-app") +include("examples:webpack-per-file-issue") + include("examples:web-worker:entity") include("examples:web-worker:view-wl") include("examples:web-worker:worker-wl")