小编Nem*_*o64的帖子

源映射在 mini-css-extract-plugin 中

我似乎无法让源映射与mini-css-extract-plugin. 我让他们与style-loader.

devtool: argv.mode === 'development' ? 'eval' : 'none',

[...]

test: /\.scss$|\.css$/i,
use: [
     {
          loader: MiniCssExtractPlugin.loader,
          options: {sourceMap: argv.mode === 'development', hmr: argv.hot},
     },
     {
         loader: 'css-loader',
         options: {sourceMap: argv.mode === 'development', importLoaders: 1},
     },

[...]

plugins: [
    [...]
    new MiniCssExtractPlugin({
        filename: argv.mode === 'development' ? '[name].css' : '[contenthash].css',
        chunkFilename: argv.mode === 'development' ? '[id].css' : '[contenthash].css',
    }),
]
Run Code Online (Sandbox Code Playgroud)

一些前沿信息:我一直使用style-loader来获取热模块替换以在开发模式和mini-css-extract-plugin生产模式下工作。

现在mini-css-extract-plugin支持 hmr,这很棒,因为我不再需要在开发中处理 FOUC。

但是没有源映射至少告诉我样式来自哪个文件很烦人。

webpack webpack-dev-server hot-module-replacement mini-css-extract-plugin

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

记录symfony中的致命错误

我正在尝试在Symfony中配置电子邮件日志记录.我按照食谱进行了操作,但我遇到致命错误的问题.

这些错误未记录在prod模式中.我发现当我添加Debug::enable();到app.php时,会记录错误,但是我仍然没有收到电子邮件.

以下是相关配置:

    mail:
        type:         fingers_crossed
        action_level: critical
        handler:      buffer
    buffer:
        type: buffer
        handler: swift
    swift:
        type:       swift_mailer
        from_email: %error_mail_from%
        to_email:   %error_mail_to%
        subject:    %error_mail_subject%
        level:      debug
Run Code Online (Sandbox Code Playgroud)

logging symfony monolog

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

在amp-iframe内的放大器页面上的Disqus

我尝试在放大器文档上实现Disqus.我的想法是使用一个amp-iframe 加载一个只包含Disqus的小文档.我使用了这个放大器框架

<amp-iframe width="300" height="300"
            layout="responsive"
            sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-scripts"
            resizable
            frameborder="0"
            seamless
            src="/disquss/name-of-blog-post">
    <div overflow tabindex=0 role=button aria-label="Read more">more!</div>
</amp-iframe>
Run Code Online (Sandbox Code Playgroud)

但是,chrome会引发内容安全策略违规:

拒绝加载脚本' https://a.disquscdn.com/next/embed/lounge.load.f3e1717b71e7256da258d3a504e56865.js ',因为它违反了以下内容安全策略指令:"script-src https:// .twitter.com : https : //api.adsnative.com/v1/ad.json *.adsafeprotected.com https://cas.criteo.com/delivery/0.1/napi.jsonp .services.disqus.com: http:// referrer .disqus.com/juggler / disqus.com http:// .twitter.com: a.disquscdn.com https://referrer.disqus.com/juggler/ https:// .services.disqus.com:*.moatads .com'unsafe-eval'https: //mobile.adnxs.com/mob https://ssl.google-analytics.com ".

所以基本上,https://a.disquscdn.com/next/embed/lounge.load.f3e1717b71e7256da258d3a504e56865.js即使a.disquscdn.com允许,也不会加载chrome .此限制来自iframe disqus使用.当我使用原生沙盒<iframe>而不是使用沙盒时,这不是问题<amp-iframe>.

我想创建一个例子,但由于iframe结构,我不能简单地创建一个jsfiddle.

disqus amp-html

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

Webpack sass loader 解析绝对路径

我希望能够在@import语句中使用绝对路径。就像是:

@import '/templates/common/variables'
Run Code Online (Sandbox Code Playgroud)

但是,sass 似乎将它解析为我的文件系统中的绝对 url。我希望它在我的项目文件夹中查找。例如。我的文件实际上位于/home/username/project/templates/common/_variables.scss

这有可能吗?

我已经看过了,includePaths但这似乎什么也没做。

我正在使用 encore 编写我的 webpack 文件,它大致如下所示:

const Encore = require('@symfony/webpack-encore');
Encore
    .setOutputPath("web/build/")
    .setPublicPath("/build")
    // [...]
    .enableSassLoader(options => {
        options.includePaths = [path.resolve(__dirname, '/web')];
    })
;
Run Code Online (Sandbox Code Playgroud)

还有这里是生成的 webpack 配置(安静冗长,我没有用上面的示例路径替换我的真实路径):

{  
    context:'/var/www',
    entry:{  
        index:[  
            './polyfills.js',
            './web/typo3conf/ext/hn_project/ext_index.js',
            './web/typo3conf/ext/hn_templates/ext_index.js'
        ],
        backend:[  
            './polyfills.js',
            './web/typo3conf/ext/hn_project/ext_backend.js'
        ]
    },
    output:{  
        path:'/var/www/web/build',
        filename:'[name].[chunkhash:8].js',
        publicPath:'/build/',
        pathinfo:false
    },
    module:{  
        rules:[  
            {  
                test:/\.jsx?$/,
                exclude:/(node_modules|bower_components)/,
                use:[  
                    {  
                        loader:'babel-loader',
                        options:{  
                            cacheDirectory:true,
                            presets:[  
                                [  
                                    'env',
                                    {  
                                        modules:false,
                                        targets:{  
                                            browsers:[  
                                                'and_chr 67',
                                                'and_uc 11.8',
                                                'chrome …
Run Code Online (Sandbox Code Playgroud)

sass webpack sass-loader webpack-encore

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

如何正确捕获错误并向错误添加信息

我想将信息添加到 typescript/javascript 中的 Error 对象。我目前这样做:

try {
    // code that might throw code
} catch (e) {
    throw new Error(`Error while processing file ${path}:\n${e}`);
}
Run Code Online (Sandbox Code Playgroud)

但这会删除先前错误中的信息。Java/PHP 在异常中都有一个previous参数,因此我可以包装错误并保留/扩展原始信息,但我似乎无法在 JavaScript 中找到等效项。

我该怎么做呢?

javascript exception typescript

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

Meteor删除已发布的包

我尝试将我的一些软件包移植到新的meteor 0.9 rc.2个中的3个确实起作用,第3个中有一个hack,它通过安装时可以正常工作meteor add.

有没有办法从meteor包服务器中删除已发布的包?我不想在存储库中打破包.

meteor

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