-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
32 lines (31 loc) · 975 Bytes
/
webpack.config.js
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
const path = require('path');
module.exports = {
mode: 'production', // or 'development'
entry: './src/index.js', // Entry point of your application
output: {
path: path.resolve(__dirname, '../diff-ymd-package', 'lib'), // Output directory
filename: 'index.js', // Output filename
library: 'DatesYMD', // Name of your library
libraryTarget: 'umd', // Universal Module Definition
// Expose the default export as a global variable
globalObject: 'this',
},
module: {
rules: [
{
test: /\.js$/, // Apply Babel only to JavaScript files
exclude: /node_modules/, // Exclude node_modules directory
use: {
loader: 'babel-loader', // Use babel-loader for transpilation
options: {
presets: ['@babel/preset-env'], // Use @babel/preset-env for compatibility
},
},
},
],
},
// Add this to see any webpack-related errors
stats: {
colors: true,
},
};