Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 1 | /* |
Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
Roman Elizarov | f0fc770 | 2018-03-06 12:45:08 +0300 | [diff] [blame] | 5 | // This script is copied to "build" directory and run from there |
| 6 | |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 7 | const webpack = require("webpack"); |
| 8 | const HtmlWebpackPlugin = require('html-webpack-plugin'); |
Roman Elizarov | 611f931 | 2018-01-13 11:18:53 +0300 | [diff] [blame] | 9 | const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 10 | const path = require("path"); |
| 11 | |
Roman Elizarov | f0fc770 | 2018-03-06 12:45:08 +0300 | [diff] [blame] | 12 | const dist = path.resolve(__dirname, "dist"); |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 13 | |
| 14 | module.exports = { |
| 15 | entry: { |
| 16 | main: "main" |
| 17 | }, |
| 18 | output: { |
| 19 | filename: "[name].bundle.js", |
| 20 | path: dist, |
| 21 | publicPath: "" |
| 22 | }, |
| 23 | devServer: { |
| 24 | contentBase: dist |
| 25 | }, |
| 26 | module: { |
| 27 | rules: [ |
| 28 | { |
| 29 | test: /\.css$/, |
| 30 | use: [ |
| 31 | 'style-loader', |
| 32 | 'css-loader' |
| 33 | ] |
| 34 | } |
| 35 | ] |
| 36 | }, |
| 37 | resolve: { |
| 38 | modules: [ |
Roman Elizarov | f0fc770 | 2018-03-06 12:45:08 +0300 | [diff] [blame] | 39 | path.resolve(__dirname, "kotlin-js-min/main"), |
| 40 | path.resolve(__dirname, "../src/main/web/") |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 41 | ] |
| 42 | }, |
Roman Elizarov | 611f931 | 2018-01-13 11:18:53 +0300 | [diff] [blame] | 43 | devtool: 'source-map', |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 44 | plugins: [ |
| 45 | new HtmlWebpackPlugin({ |
| 46 | title: 'Kotlin Coroutines JS Example' |
| 47 | }), |
Roman Elizarov | 611f931 | 2018-01-13 11:18:53 +0300 | [diff] [blame] | 48 | new UglifyJSPlugin({ |
| 49 | sourceMap: true |
| 50 | }) |
Roman Elizarov | decbc83 | 2017-12-26 23:05:20 +0300 | [diff] [blame] | 51 | ] |
| 52 | }; |