/* * (C) Copyright IBM Corp. 2012, 2016 All Rights Reserved. * * 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. */ const DojoWebpackPlugin = require("dojo-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); var path = require("path"); var webpack = require("webpack"); module.exports = { context: path.resolve(__dirname, "UI"), entry: "js-src/webpack/bootstrap.js", output: { path: path.join(__dirname, "UI/js"), publicPath: "js/", pathinfo: true, filename: '[name].js', }, module: { rules: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, use: ['babel-loader'] } ], }, plugins: [ new DojoWebpackPlugin({ loaderConfig: require("./UI/js-src/webpack/loaderConfig"), environment: {dojoRoot: "UI/js"}, // used at run time for non-packed resources (e.g. blank.gif) buildEnvironment: {dojoRoot: "js-src"}, // used at build time locales: ["en"], }) ], resolveLoader: { modules: [ 'js-src', 'node_modules' ], }, resolve: { extensions: ["*", ".js", ".jsx", ".json"], }, mode: "development", optimization: { minimizer: [ // we specify a custom UglifyJsPlugin here to get source maps in production new UglifyJsPlugin({ cache: true, parallel: true, uglifyOptions: { compress: true, mangle: true, output: {comments:false} }, sourceMap: true // set to true if you want JS source maps }) ], }, devtool: "#source-map" };