Skip to content

Commit 453633d

Browse files
committed
chore: update webpack configuration to use CommonJS format and adjust pack script in package.json
1 parent cc80c96 commit 453633d

File tree

2 files changed

+5
-29
lines changed

2 files changed

+5
-29
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && bash ./postBuild.sh",
1212
"build:clean": "npm run clean && npm run build",
1313
"build:watch": "npm run clean && tsc --watch",
14-
"pack": "webpack --config webpack/webpack.config.js",
14+
"pack": "webpack --config webpack/webpack.config.cjs",
1515
"lint": "eslint src",
1616
"prepublish": "npm run build:clean",
1717
"betapublish": "npm publish --tag beta"
Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const BundleAnalyzerPlugin =
44

55
function generateConfig(name) {
66
var config = {
7-
entry: './lib/index.js',
7+
entry: './dist/cjs/index.js',
88
output: {
99
path: path.resolve(__dirname, '../dist'),
1010
filename: name + '.js',
@@ -19,9 +19,9 @@ function generateConfig(name) {
1919
// Add '.ts' and '.tsx' as resolvable extensions.
2020
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'],
2121
alias: {
22-
[path.resolve(__dirname, '../lib/util/node-support.js')]: path.resolve(
22+
[path.resolve(__dirname, '../dist/cjs/util/node-support.js')]: path.resolve(
2323
__dirname,
24-
'../lib/util/browser-support.js',
24+
'../dist/cjs/util/browser-support.js',
2525
),
2626
},
2727
fallback: {
@@ -34,31 +34,7 @@ function generateConfig(name) {
3434

3535
module: {
3636
rules: [
37-
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
38-
{ test: /\.tsx?$/, loader: 'ts-loader' },
39-
40-
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
41-
{ test: /\.js$/, loader: 'source-map-loader' },
42-
43-
{
44-
test: /\.m?js$/,
45-
exclude: /(node_modules|bower_components|samples|lib|test|coverage)/,
46-
use: {
47-
loader: 'babel-loader',
48-
options: {
49-
presets: [
50-
[
51-
'@babel/preset-env',
52-
{
53-
targets: {
54-
node: 'current',
55-
},
56-
},
57-
],
58-
],
59-
},
60-
},
61-
},
37+
// Code is already transpiled from TypeScript, no additional loaders needed
6238
],
6339
},
6440
};

0 commit comments

Comments
 (0)