UNPKG

923 BJavaScriptView Raw
1const fs = require('fs');
2const path = require('path');
3const webpack = require('webpack');
4
5module.exports = (env, argv) => ({
6 entry: './src/index.ts',
7 output: {
8 filename: 'viewer.min.js',
9 path: path.resolve(__dirname, 'dist/'),
10 library: 'ModelViewer',
11 },
12 plugins: [
13 new webpack.BannerPlugin(fs.readFileSync('LICENSE', 'utf8')),
14 // Note: this is needed to compile fengari for the web.
15 new webpack.DefinePlugin({
16 'process.env.FENGARICONF': 'void 0',
17 'typeof process': JSON.stringify('undefined'),
18 }),
19 ],
20 performance: {
21 hints: false,
22 },
23 module: {
24 rules: [
25 {
26 test: /\.ts$/,
27 exclude: /node_modules/,
28 use: [
29 'ts-loader',
30 ],
31 },
32 ],
33 },
34 resolve: {
35 extensions: ['.ts', '.js'],
36 },
37 devtool: argv.mode === 'development' ? 'cheap-module-eval-source-map' : '',
38});