blob: 294cfe0d6d2caee47b08d7ebae9ae498f7193def [file] [log] [blame]
Roman Elizarovdecbc832017-12-26 23:05:20 +03001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarovdecbc832017-12-26 23:05:20 +03003 */
4
Roman Elizarovf0fc7702018-03-06 12:45:08 +03005// This script is copied to "build" directory and run from there
6
Roman Elizarovdecbc832017-12-26 23:05:20 +03007const webpack = require("webpack");
8const HtmlWebpackPlugin = require('html-webpack-plugin');
Roman Elizarov611f9312018-01-13 11:18:53 +03009const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
Roman Elizarovdecbc832017-12-26 23:05:20 +030010const path = require("path");
11
Roman Elizarovf0fc7702018-03-06 12:45:08 +030012const dist = path.resolve(__dirname, "dist");
Roman Elizarovdecbc832017-12-26 23:05:20 +030013
14module.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 Elizarovf0fc7702018-03-06 12:45:08 +030039 path.resolve(__dirname, "kotlin-js-min/main"),
40 path.resolve(__dirname, "../src/main/web/")
Roman Elizarovdecbc832017-12-26 23:05:20 +030041 ]
42 },
Roman Elizarov611f9312018-01-13 11:18:53 +030043 devtool: 'source-map',
Roman Elizarovdecbc832017-12-26 23:05:20 +030044 plugins: [
45 new HtmlWebpackPlugin({
46 title: 'Kotlin Coroutines JS Example'
47 }),
Roman Elizarov611f9312018-01-13 11:18:53 +030048 new UglifyJSPlugin({
49 sourceMap: true
50 })
Roman Elizarovdecbc832017-12-26 23:05:20 +030051 ]
52};