小编J.M*_*ael的帖子

在 Chrome 中显示推送消息

我想使用服务人员显示推送通知。在开发人员工具 -> 应用程序 -> 服务人员中,我有测试文本"a": "test message",按下推送并收到以下错误:

serviceWorker.js:48 Uncaught (in promise) TypeError: Failed to execute 
'showNotification' on 'ServiceWorkerRegistration': No notification 
permission has been granted for this origin. 
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?当您单击按钮时,是否会弹出通知?

javascript reactjs service-worker

5
推荐指数
1
解决办法
5045
查看次数

webpack 看不到绝对路径

我在 React 应用程序中使用绝对路径。但是 WebPack 给了我一个错误。ERROR in ./src/index.js Module not found: Error: Can't resolve 'App' in .../client/src'但是,我的文件位于此文件夹中。如何解决这个问题呢?我看到我已经写过类似的问题,但我没有在其中找到答案

网络包配置

    const path = require('path');
    const HtmlWebpackPlugin = require('html-webpack-plugin');
    const MiniCssExtractPlugin = require('mini-css-extract-plugin');

    module.exports = {
        entry: './src/index.js',
        output: {
            path: path.resolve(__dirname, 'build'),
            publicPath: '/',
            filename: 'bundle.js'
        },
        resolve: {
            extensions: ['.js', '.jsx']
        },
        module: {
            rules: [
                {
                    test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'
                },
                {
                    test: /\.css$/, use: ['style-loader', 'css-loader'],
                }
                ]
        },
        plugins: [
            new HtmlWebpackPlugin({
                filename: 'index.html',
                template: …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs webpack

1
推荐指数
1
解决办法
2481
查看次数

标签 统计

javascript ×2

reactjs ×2

service-worker ×1

webpack ×1