Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
54 lines (54 loc) · 1.57 KB
/
Copy pathwebpack.config.js
File metadata and controls
54 lines (54 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpack = require('webpack');
const pkg = require('./package.json');
module.exports = {
entry: './src/index.tsx',
output: {
filename: 'index.js',
chunkFilename: '[name].[contenthash].js',
globalObject: 'this' /* So window references don't break in NextJS */,
library: {
name: 'Feathery',
type: 'umd'
}
},
plugins: [
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
__PACKAGE_VERSION__: JSON.stringify(pkg.version),
// Keep the UMD build aligned with the Rollup ESM/CJS builds.
__SYNCFUSION_LICENSE_KEY__: JSON.stringify(
process.env.SYNCFUSION_LICENSE_KEY || ''
)
})
],
module: {
rules: [
{
test: /pptxWorkerSource\.ts$/,
enforce: 'pre',
use: require.resolve('./scripts/pptx-worker-loader.cjs')
},
{
// .d.ts files get matched by ts
test: /\.(ts|tsx)?$/,
exclude: /node_modules/,
use: 'ts-loader'
},
{
test: /\.(js|jsx)$/,
// Linked packages (yarn link) resolve to their real path outside
// node_modules, so also skip prebuilt dist output — otherwise
// transform-runtime injects @babel/runtime imports into it.
exclude: [/node_modules/, /client-utils[\\/]dist/],
use: ['babel-loader']
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx', '.d.ts'],
fallback: {
stream: false // jszip references Node's stream module but doesn't need it in browser
}
}
};