// webpack.config.js var webpack = require('webpack'); const path = require('path') const ExtractTextPlugin = require('extract-text-webpack-plugin'); //var moment = require('moment'); //const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const env = process.env.WEBPACK_MODE; function sourcemapActive() { if(env === "development") { return 'inline-source-map'; } else return 'none'; } module.exports = { entry: { api: __dirname + '/src/customApi/index.js', gtw: __dirname + '/src/modules/gtw/gtw.js', HelloWorld: __dirname + '/src/modules/helloWorld/helloWorld.js' /* AttachSaveAll: __dirname + '/src/modules/AttachSaveAll/AttachSaveAllModul.js', entry: __dirname + '/src/modules/ArJsApi/index.js', ITSMConfigPackDND: __dirname + '/src/modules/ConfigPacks/DragAndDrop/itsmConfigPack', HelloWorld: __dirname + '/src/modules/HelloWorld/HelloWorldModul.js'*/ }, output: { filename: 'ntt.smartit.[name].js', library: ['ntt','smartit','[name]'], //libraryExport:'default', libraryTarget: 'umd' }, mode: env || "development", node: { console: false, fs: 'empty', net: 'empty', tls: 'empty' }, cache: true, devtool: sourcemapActive(), //'inline-source-map', externals: { jquery: 'jQuery' }, module: { rules: [ { test: /\.js$/, loader: 'babel-loader', exclude:/(node_modules|ressources)/ , query: { //presets: ['es2015'] presets: ["@babel/preset-env"] } }, { test: /\.css$/, use: ExtractTextPlugin.extract( { fallback: 'style-loader', use: ['css-loader'] }) }, /*{ test: /\.svg$/, loader: 'svg-inline-loader' }*/ ] }, /*resolve: { extensions: ['*', '.js'], alias: { 'moment': path.resolve(__dirname, './moment') // <-- When you build or restart dev-server, you'll get an error if the path to your utils.js file is incorrect. } },*/ plugins: [ /* new ExtractTextPlugin({ filename: './ntt-ar-js.css' }),*/ new webpack.ProvidePlugin({ "$":"jquery", "jQuery":"jquery", "window.jQuery":"jquery" //"moment":"moment" }), //new webpack.IgnorePlugin(/(locale)/, /node_modules.+(momentjs)/), //new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // new BundleAnalyzerPlugin({generateStatsFile:true}) /*new webpack.IgnorePlugin({ resourceRegExp: /ressources/ })*/ ] /*plugins: [ //var options = [] //options : {}; /*options={ '[file].map', null, "[absolute-resource-path]", "[absolute-resource-path]" },*/ /*new webpack.SourceMapDevToolPlugin({ filename:'[file].map', })*/ //] }