Files
android_development/tools/winscope/webpack.config.dev.js
Pablo Gamito 3f23913059 Update webpack config to compile Kotlin flickerlib to JS
The kotlin webpack plugin requires the latest webpack version so webpack was updated and refactored to modern standards

Test: Run 'yarn run dev' and 'yarn run build' and make sure everything still build and that a JavaScript compiled version of flickerlib is found in 'kotlin_build'
Change-Id: I02cc1e5bb16afeb5c407a18926ee485d715e41df
2020-08-04 12:16:40 +01:00

73 lines
2.0 KiB
JavaScript

/*
* Copyright 2020, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const path = require('path');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const commonConfig = require('./webpack.config.common');
const environment = require('./env/dev.env');
const webpackConfig = merge(commonConfig, {
mode: 'development',
devtool: 'cheap-module-eval-source-map',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'js/[name].bundle.js',
chunkFilename: 'js/[id].chunk.js'
},
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all'
}
},
module: {
rules: [
// Enable sourcemaps for Kotlin code, source-map-loader should be configured
{
test: /\.js$/,
include: path.resolve(__dirname, './kotlin_build'),
exclude: [
/kotlin\.js$/, // Kotlin runtime doesn't have sourcemaps at the moment
],
use: ['source-map-loader'],
enforce: 'pre'
},
]
},
plugins: [
new webpack.EnvironmentPlugin(environment),
new webpack.HotModuleReplacementPlugin(),
new FriendlyErrorsPlugin()
],
devServer: {
compress: true,
historyApiFallback: true,
hot: true,
open: true,
overlay: true,
port: 8080,
stats: {
normal: true
}
}
});
module.exports = webpackConfig;