-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch melon head from parcel to webpack (#99)
Parcel is full of weird & annoying issued so it will be better to use webpack.
- Loading branch information
1 parent
82c9ee3
commit d180819
Showing
16 changed files
with
3,626 additions
and
2,832 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
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
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
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
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
<!doctype html> | ||
<head> | ||
<title>Melon Head</title> | ||
<link rel="stylesheet" href="/static/css/main.css"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="index.js" type="module"></script> | ||
</body> |
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,70 @@ | ||
const path = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | ||
const config = require('./config.json'); | ||
|
||
module.exports = (env, argv) => { | ||
const mode = argv.model === 'production' ? 'production' : 'development'; | ||
console.log("webpack runs in", mode, "mode"); | ||
|
||
return { | ||
mode, | ||
entry: path.resolve(__dirname, './src/index.js'), | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.scss$/i, | ||
use: [ | ||
"style-loader", | ||
{ | ||
loader: "css-loader", | ||
options: { | ||
importLoaders: 1, | ||
modules: { | ||
namedExport: true, | ||
localIdentName: "[local]--[hash:base64:16]", | ||
exportLocalsConvention: "camelCaseOnly", | ||
}, | ||
}, | ||
}, | ||
"sass-loader", | ||
], | ||
}, | ||
{ | ||
test: /\.css$/i, | ||
use: [ | ||
"style-loader", "css-loader" | ||
], | ||
}, | ||
{ | ||
test: /\.(png|jpg|gif|svg)$/, | ||
use: [{ | ||
loader: 'file-loader', | ||
options: { | ||
name: '[name]--[contenthash].[ext]', | ||
esModule: false, | ||
} | ||
}] | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.bs.js'], | ||
}, | ||
output: { | ||
filename: 'bundle-[contenthash].js', | ||
path: path.resolve(__dirname, 'dist'), | ||
}, | ||
devServer: { | ||
port: 1234, | ||
historyApiFallback: true, | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new HtmlWebpackPlugin({ | ||
template: path.resolve(__dirname, "./src/index.html"), | ||
publicPath: '/', | ||
}), | ||
], | ||
}; | ||
}; |