UNPKG

angular-formio

Version:

The Form.io dynamic form and data management system for Angular.

94 lines (91 loc) 2.1 kB
import * as path from 'path'; import * as fs from 'fs'; import * as webpack from 'webpack'; import * as angularExternals from 'webpack-angular-externals'; import * as rxjsExternals from 'webpack-rxjs-externals'; const pkg = JSON.parse(fs.readFileSync('./package.json').toString()); export default { entry: { 'angular-formio.umd': path.join(__dirname, 'src', 'index.ts'), 'angular-formio.umd.min': path.join(__dirname, 'src', 'index.ts'), }, output: { path: path.join(__dirname, 'dist', 'bundles'), filename: '[name].js', libraryTarget: 'umd', library: 'angular-formio' }, externals: [ angularExternals(), rxjsExternals() ], devtool: 'source-map', module: { rules: [ { test: /\.ts$/, loader: 'tslint-loader', exclude: /node_modules/, enforce: 'pre', options: { emitErrors: true, failOnHint: true } }, { test: /\.ts$/, loader: 'ts-loader', exclude: /node_modules/ }, { test: /\.html$/, loader: 'html-loader', options: { attrs: [':data-src'] } }, { test: /\.css$/, use: ['style-loader', 'css-loader'] }, { test: /\.(svg|png|jpg|gif)$/, use: [ { loader: 'url-loader', options: { limit: 8192 } } ] } ] }, resolve: { extensions: ['.ts', '.js'] }, plugins: [ new webpack.optimize.ModuleConcatenationPlugin(), new webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/, sourceMap: true }), new webpack.ContextReplacementPlugin( /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, path.join(__dirname, 'src') ), new webpack.BannerPlugin({ banner: ` /** * ${pkg.name} - ${pkg.description} * @version v${pkg.version} * @author ${pkg.author} * @link ${pkg.homepage} * @license ${pkg.license} */ `.trim(), raw: true, entryOnly: true }) ] };