Kotlin / kotlin-frontend-plugin

Gradle Kotlin (http://kotlinlang.org) plugin for frontend development
Apache License 2.0
564 stars 69 forks source link

Webpack dev server shouldn't include DCE'd sources #78

Open JakeWharton opened 6 years ago

JakeWharton commented 6 years ago

When the DCE plugin is enabled, kotlin-js-min/main is added to the webpack.config.js config. This can be seen on the 'frontend-only' example by invoking the run task. The bundle that's loaded, however, does not contain DCE'd user code. build/js/frontend-only.js contains a reference to Kotlin.defineModule('frontend-only', _); which has been removed from build/kotlin-js-min/kotlin.js. This causes a JS error when you load the development site.

Modification of the build configuration shouldn't be needed in order to create a production DCE'd bundle and to run a development non-DCE'd local build.

JakeWharton commented 6 years ago

This has nothing to do with the dev server. Doing a normal 'bundle' will use the wrong JS file as the entry point (which contains the defineModule call) instead of the one in the DCE output folder.