1 Star 0 Fork 0

manju-edu / manju-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
Rockung 提交于 2020-06-16 12:06 . reshape the directory structure
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const mode = process.env.NODE_ENV || 'development';
const prod = mode === 'production';
module.exports = {
entry: {
'manju-web': ['./src/main.js'],
},
output: {
path: path.resolve(__dirname, 'public/manju-web'),
filename: '[name].js',
chunkFilename: '[name].[id].js'
},
resolve: {
alias: {
svelte: path.resolve('node_modules', 'svelte'),
},
extensions: ['.mjs', '.js', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main'],
},
module: {
rules: [
{
test: /\.svelte$/,
exclude: /node_modules/,
use: { loader: 'svelte-loader', options: { emitCss: true, hotReload: true } },
},
{
test: /\.css$/,
// MiniCssExtractPlugin doesn't support.
// For developing, use style-loader instead.
use: [prod ? MiniCssExtractPlugin.loader : 'style-loader', 'css-loader'],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
],
presets: [
'@babel/preset-env',
]
},
}
},
],
},
plugins: [
new MiniCssExtractPlugin({ filename: '[name].css' }),
],
mode,
devtool: prod ? false : 'source-map',
devServer: {
contentBase: path.join(__dirname, 'public'),
publicPath: '/manju-web/',
hot: false,
liveReload: true,
watchContentBase: true,
},
};
JavaScript
1
https://gitee.com/manju-edu/manju-web.git
git@gitee.com:manju-edu/manju-web.git
manju-edu
manju-web
manju-web
master

搜索帮助