-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable development and production bundling with Webpack
- Loading branch information
Showing
2 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
mode: "production", | ||
entry: './src/antlr4/index.js', | ||
output: { | ||
filename: 'antlr4.js', | ||
path: path.resolve(__dirname, 'dist'), | ||
// the name of the exported antlr4 | ||
library: "antlr4", | ||
libraryTarget: 'window' | ||
}, | ||
node: { | ||
module: "empty", | ||
net: "empty", | ||
fs: "empty" | ||
}, | ||
target: "web", | ||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
} | ||
}] | ||
} | ||
} | ||
module.exports = (env, argv) => { | ||
return { | ||
entry: './src/antlr4/index.js', | ||
output: { | ||
filename: | ||
argv.mode === 'production' ? 'antlr4.min.js' : 'antlr4.js', | ||
path: path.resolve(__dirname, 'dist'), | ||
// the name of the exported antlr4 | ||
library: 'antlr4', | ||
libraryTarget: 'umd', | ||
}, | ||
node: { | ||
module: 'empty', | ||
net: 'empty', | ||
fs: 'empty', | ||
}, | ||
target: 'web', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
}; |