代码拉取完成,页面将自动刷新
同步操作将从 神童小子/iview-chrome-extension 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const webpack = require("webpack");
const ejs = require("ejs");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const ExtensionReloader = require("webpack-extension-reloader");
const { VueLoaderPlugin } = require("vue-loader");
const { version } = require("./package.json");
const config = {
mode: process.env.NODE_ENV,
context: __dirname + "/src",
entry: {
background: "./background.js",
"popup/popup": "./popup/popup.js"
},
output: {
path: __dirname + "/dist",
filename: "[name].js"
},
resolve: {
extensions: [".js", ".vue"]
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
},
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"]
},
{
test: /\.sass$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader?indentedSyntax"
]
},
{
test: /\.(png|jpg|jpeg|gif|svg|ico)$/,
loader: "file-loader",
options: {
name: "[path][name].[ext]",
outputPath: "/images/",
emitFile: true,
esModule: false
}
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader",
options: {
name: "[path][name].[ext]",
outputPath: "/fonts/",
emitFile: true,
esModule: false
}
}
]
},
plugins: [
new webpack.DefinePlugin({
global: "window"
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: "[name].css"
}),
new CopyPlugin([
{ from: "icons", to: "icons", ignore: ["icon.xcf"] },
{ from: "images", to: "images" },
{
from: "popup/popup.html",
to: "popup/popup.html",
transform: transformHtml
},
{
from: "manifest.json",
to: "manifest.json",
transform: content => {
const jsonContent = JSON.parse(content);
jsonContent.version = version;
if (config.mode === "development") {
jsonContent["content_security_policy"] =
"script-src 'self' 'unsafe-eval'; object-src 'self'";
}
return JSON.stringify(jsonContent, null, 2);
}
}
])
]
};
if (config.mode === "production") {
config.plugins = (config.plugins || []).concat([
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: '"production"'
}
})
]);
}
if (process.env.HMR === "true") {
config.plugins = (config.plugins || []).concat([
new ExtensionReloader({
manifest: __dirname + "/src/manifest.json"
})
]);
}
function transformHtml(content) {
return ejs.render(content.toString(), {
...process.env
});
}
module.exports = config;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。