mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) webpack v5
This commit is contained in:
parent
2e192d860a
commit
a6606419dc
4 changed files with 21 additions and 9 deletions
|
|
@ -10,11 +10,12 @@ const {
|
||||||
const {env} = process;
|
const {env} = process;
|
||||||
const isDev = env.NODE_ENV === 'development';
|
const isDev = env.NODE_ENV === 'development';
|
||||||
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
//const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
|
|
||||||
const extractCSS = (a) => new ExtractTextPlugin(`${a}.css`);
|
//const extractCSS = (a) => new ExtractTextPlugin(`${a}.css`);
|
||||||
const extractMain = extractCSS('[name]');
|
//const extractMain = extractCSS('[name]');
|
||||||
|
|
||||||
const cssNames = [
|
const cssNames = [
|
||||||
'nojs',
|
'nojs',
|
||||||
|
|
@ -25,23 +26,27 @@ const cssNames = [
|
||||||
...getCSSList('columns'),
|
...getCSSList('columns'),
|
||||||
];
|
];
|
||||||
|
|
||||||
const cssPlugins = cssNames.map(extractCSS);
|
//const cssPlugins = cssNames.map(extractCSS);
|
||||||
const clean = (a) => a.filter(Boolean);
|
const clean = (a) => a.filter(Boolean);
|
||||||
|
|
||||||
const plugins = clean([
|
const plugins = clean([
|
||||||
...cssPlugins,
|
new MiniCssExtractPlugin(),
|
||||||
extractMain,
|
//...cssPlugins,
|
||||||
|
//extractMain,
|
||||||
!isDev && new OptimizeCssAssetsPlugin(),
|
!isDev && new OptimizeCssAssetsPlugin(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const rules = [{
|
const rules = [{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
exclude: /css\/(nojs|view|config|terminal|user-menu|columns.*)\.css/,
|
exclude: /css\/(nojs|view|config|terminal|user-menu|columns.*)\.css/,
|
||||||
|
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
||||||
|
/*
|
||||||
use: extractMain.extract([
|
use: extractMain.extract([
|
||||||
'css-loader',
|
'css-loader',
|
||||||
]),
|
]),
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
...cssPlugins.map(extract), {
|
/*...cssPlugins.map(extract),*/ {
|
||||||
test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
|
test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'url-loader',
|
loader: 'url-loader',
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const {
|
||||||
const {EnvironmentPlugin} = require('webpack');
|
const {EnvironmentPlugin} = require('webpack');
|
||||||
const WebpackBar = require('webpackbar');
|
const WebpackBar = require('webpackbar');
|
||||||
|
|
||||||
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
|
//const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
|
||||||
|
|
||||||
const dir = './client';
|
const dir = './client';
|
||||||
const dirModules = './client/modules';
|
const dirModules = './client/modules';
|
||||||
|
|
@ -51,10 +51,12 @@ const plugins = [
|
||||||
NODE_ENV,
|
NODE_ENV,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
/*
|
||||||
new ServiceWorkerWebpackPlugin({
|
new ServiceWorkerWebpackPlugin({
|
||||||
entry: join(__dirname, '..', 'client', 'sw', 'sw.js'),
|
entry: join(__dirname, '..', 'client', 'sw', 'sw.js'),
|
||||||
excludes: ['*'],
|
excludes: ['*'],
|
||||||
}),
|
}),
|
||||||
|
*/
|
||||||
|
|
||||||
new WebpackBar(),
|
new WebpackBar(),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@ const load = require('load.js');
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development';
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
|
/*
|
||||||
const {
|
const {
|
||||||
registerSW,
|
registerSW,
|
||||||
listenSW,
|
listenSW,
|
||||||
} = require('./sw/register');
|
} = require('./sw/register');
|
||||||
|
*/
|
||||||
|
|
||||||
// prevent additional loading of emitify
|
// prevent additional loading of emitify
|
||||||
window.Emitify = require('emitify');
|
window.Emitify = require('emitify');
|
||||||
|
|
@ -29,7 +31,7 @@ module.exports = window.CloudCmd = async (config) => {
|
||||||
|
|
||||||
await register(config);
|
await register(config);
|
||||||
|
|
||||||
require('./listeners');
|
//require('./listeners');
|
||||||
require('./key');
|
require('./key');
|
||||||
require('./sort');
|
require('./sort');
|
||||||
|
|
||||||
|
|
@ -64,10 +66,12 @@ const onUpdateFound = wraptile(async (config) => {
|
||||||
window.CloudCmd(config);
|
window.CloudCmd(config);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
async function register(config) {
|
async function register(config) {
|
||||||
const {prefix} = config;
|
const {prefix} = config;
|
||||||
const sw = await registerSW(prefix);
|
const sw = await registerSW(prefix);
|
||||||
|
|
||||||
listenSW(sw, 'updatefound', onUpdateFound(config));
|
listenSW(sw, 'updatefound', onUpdateFound(config));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,7 @@
|
||||||
"load.js": "^3.0.0",
|
"load.js": "^3.0.0",
|
||||||
"madrun": "^8.6.0",
|
"madrun": "^8.6.0",
|
||||||
"memfs": "^3.0.1",
|
"memfs": "^3.0.1",
|
||||||
|
"mini-css-extract-plugin": "^2.4.5",
|
||||||
"minor": "^1.2.2",
|
"minor": "^1.2.2",
|
||||||
"mock-require": "^3.0.1",
|
"mock-require": "^3.0.1",
|
||||||
"morgan": "^1.6.1",
|
"morgan": "^1.6.1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue