UNPKG

react-web-native-sketch

Version:

[TODO: We need an overview of how this can be used via npm vs as a local package]

69 lines (62 loc) 1.86 kB
const path = require('path'); const webpack = require('webpack'); // const nodeModulesPath = path.resolve(__dirname, 'node_modules'); const UglifyJs = require('uglifyjs-webpack-plugin'); module.exports = { entry: '../src/index.ts', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist'), publicPath: '/', sourceMapFilename: "bundle.js.map", }, devtool: 'source-map', module: { rules: [ { test: /\.tsx?$/, exclude: /node_modules/, loader: 'babel-loader!awesome-typescript-loader', }, // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. { enforce: "pre", test: /\.js$/, loader: "source-map-loader", exclude: /node_modules/ }, { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, }, ] }, resolve: { extensions: [".ts", ".tsx", ".js", ".json"], modules: ['.', 'node_modules'] }, plugins: [ new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': 'production' } }), new UglifyJs({ // sourceMap: true, uglifyOptions: { mangle: true, compress: { warnings: false, // Suppress uglification warnings pure_getters: true, unsafe: true, unsafe_comps: true, }, output: { comments: false, }, exclude: [/\.min\.js$/gi] // skip pre-minified libs } }), ] };