Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/webpack #12

Merged
merged 3 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]

### Added
- Bundling with Webpack.

### Changed
- New logo!

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "voxelizer",
"version": "0.1.3",
"description": "Voxelization for 3D models",
"main": "lib/index.js",
"main": "lib/voxelizer.js",
"module": "src/index.js",
"scripts": {
"build": "babel src -d lib",
"test": "jest",
Expand Down
47 changes: 47 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const webpack = require("webpack");
const path = require("path");
const mode = 'production';

const pkg = require('./package.json');
const date = (new Date()).toDateString();

const banner = `${pkg.name} v${pkg.version} ${date}
${pkg.homepage}

@author ${pkg.author.name} <${pkg.author.email}>
@copyright ${date.slice(-4)} ${pkg.author.name}
@license ${pkg.license}
@version ${pkg.version}
@build [hash]`;

let umdConfig = {
mode: mode,
devtool: 'source-map',
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "lib"),
filename: "voxelizer.js",
library: "Voxelizer",
libraryTarget: 'umd',
globalObject: 'this'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader"
}
}
]
},
plugins: [
new webpack.BannerPlugin({banner: banner}),
],
externals: {
three: 'THREE',
}
};

module.exports = umdConfig;