forked from M-Labs/web2019
Optimize webpack usage
Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
parent
ddd49b71af
commit
053d31ddce
@ -18,9 +18,8 @@ Start:
|
|||||||
zola serve
|
zola serve
|
||||||
```
|
```
|
||||||
|
|
||||||
To update the .min.js, .bundle.js and .jsx file:
|
To update the .bundle.js and .jsx file:
|
||||||
|
|
||||||
```
|
```
|
||||||
nix-shell -p nodejs --run "npm run build"
|
nix-shell -p nodejs --run "npm run build"
|
||||||
nix-shell -p nodejs --run "npx webpack"
|
|
||||||
```
|
```
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
"description": "These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. For deployment, see the nix-scripts repository. Commits to https://git.m-labs.hk/M-Labs/web2019.git are automatically deployed to m-labs.hk through Hydra.",
|
"description": "These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. For deployment, see the nix-scripts repository. Commits to https://git.m-labs.hk/M-Labs/web2019.git are automatically deployed to m-labs.hk through Hydra.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "./node_modules/.bin/babel static/js/shop.jsx --watch -o static/js/shop_bundle.js",
|
"start": "npx webpack --watch",
|
||||||
"build": "./node_modules/.bin/babel static/js/shop.jsx -o static/js/shop.min.js"
|
"build": "npx webpack"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2191
static/js/shop.min.js
vendored
2191
static/js/shop.min.js
vendored
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
<!-- Load our React component. -->
|
<!-- Load our React component. -->
|
||||||
<!-- <script type="text/babel" src="{{ get_url(path='js/shop.jsx', cachebust=true) }}"></script> -->
|
<!-- <script type="text/babel" src="{{ get_url(path='js/shop.jsx', cachebust=true) }}"></script> -->
|
||||||
<!-- <script src="{{ get_url(path='js/shop.min.js', cachebust=true) }}"></script> -->
|
|
||||||
<script src="{{ get_url(path='js/shop.bundle.js', cachebust=true) }}"></script>
|
<script src="{{ get_url(path='js/shop.bundle.js', cachebust=true) }}"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -2,7 +2,7 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
shop: './static/js/shop.min.js'
|
shop: './static/js/shop.jsx'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, './static/js'),
|
path: path.resolve(__dirname, './static/js'),
|
||||||
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.(js|jsx)$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: 'babel-loader'
|
use: 'babel-loader'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user