-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabling source maps and fine tuned webpack config.
* Created dev and prod webpack config, by following the conventions in https://webpack.js.org/guides/production/ * For dev config, using eval source map. * For prod config, uglifying and doing a standard sourcemap. * Since we have a ml5.min.js and sourcemap, there is no longer a near for ml5.js * Changed the watch task to be yarn start updated to posenet latest version, which has an es6 dist to enable better viewing of the source code updated contributing to reflect new build process
- Loading branch information
Showing
10 changed files
with
11,775 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,14 +26,14 @@ npm install | |
|
||
Run this command from the root of the project: | ||
```bash | ||
npm run start:dev | ||
npm run start | ||
``` | ||
|
||
Will output something like this: | ||
|
||
```bash | ||
Project is running at https://localhost:8080/ | ||
webpack output is served from /dist/ | ||
webpack output is served from / | ||
Hash: 16b80528bf532975b279 | ||
Version: webpack 2.6.1 | ||
|
@@ -71,7 +71,7 @@ Create a new folder called `/experiments` in the project's root folder. Create a | |
<html> | ||
<head> | ||
<title>Test</title> | ||
<script src="../../dist/ml5.js"></script> | ||
<script src="https://localhost:8080/ml5.js"></script> | ||
</head> | ||
<body> | ||
|
@@ -109,11 +109,11 @@ Create a new folder called `/experiments` in the project's root folder. Create a | |
That should output something very similar to the `webpack-dev-server` but you'll notice that at the end is this line: | ||
|
||
```bash | ||
> [email protected] build:min /Users/ml5/Desktop/sandbox/ml5 | ||
> uglifyjs dist/ml5.js -o dist/ml5.min.js | ||
> webpack --config webpack.prod.babel.js | ||
> Done in 15.13s. | ||
``` | ||
|
||
Which means the library was successfully build and minified. | ||
Which means the library was successfully built and minified. | ||
|
||
6. (OPTIONAL) Commit your changes. We are using [commitizen](https://github.com/commitizen/cz-cli) to commit changes. Commitizen is a tool that allows you to specify commit in a more precise way. You can run it instead of your regular `git commit -m 'msg'` with: | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2018 ml5 | ||
// | ||
// This software is released under the MIT License. | ||
// https://opensource.org/licenses/MIT | ||
|
||
import { join } from 'path'; | ||
import merge from 'webpack-merge'; | ||
import common from './webpack.common.babel'; | ||
import HtmlWebpackPlugin from 'html-webpack-plugin'; | ||
|
||
export default merge(common, { | ||
mode: 'development', | ||
devtool: 'inline-source-map', | ||
devServer: { | ||
watchContentBase: true, | ||
contentBase: join(__dirname, './dist') | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
title: 'ml5' | ||
}) | ||
] | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2018 ml5 | ||
// | ||
// This software is released under the MIT License. | ||
// https://opensource.org/licenses/MIT | ||
|
||
import merge from 'webpack-merge'; | ||
import common from './webpack.common.babel'; | ||
import UglifyJSPlugin from 'uglifyjs-webpack-plugin'; | ||
|
||
export default merge(common, { | ||
mode: 'production', | ||
devtool: 'source-map', | ||
output: { | ||
filename: 'ml5.min.js' | ||
}, | ||
plugins: [ | ||
new UglifyJSPlugin({ | ||
sourceMap: true | ||
}) | ||
] | ||
}) |
Oops, something went wrong.