Skip to content

Instantly share code, notes, and snippets.

@painor
Created November 14, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save painor/b26153151e5a5f8b7b9b6124178efa0f to your computer and use it in GitHub Desktop.
Save painor/b26153151e5a5f8b7b9b6124178efa0f to your computer and use it in GitHub Desktop.
testing webpack
function f() {
console.log('ok')
}
module.exports = {
f,
}
import { f } from './gramjs.js'
f()
<html>
<head>
<title>Title</title>
<script type="module" src="f1.js"></script>
</head>
<body>
</body>
<script>
</script>
</html>
module.exports = {
entry: './example.js',
mode: 'development',
node: {
fs: 'empty',
},
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
],
plugins: [
'@babel/plugin-proposal-class-properties',
],
},
},
},
],
},
output: {
path: __dirname,
filename: 'gramjs.js',
library: 'gramjs',
libraryTarget: 'umd',
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment