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