小编Cer*_*rad的帖子

RewriteCond 文件存在

这么简单的问题但是htaccess和我从来没有相处过。

  1. 如果文件存在,则提供该文件。
  2. 如果 URI 只是 / 并且 index.html 存在,则提供 index.html
  3. 否则提供 app.php

这是.htaccess:

# Disable the directory processing, Apache 2.4
DirectoryIndex disabled xxx

RewriteEngine On

# Serve existing files
RewriteCond %{REQUEST_FILENAME} -f

RewriteRule .? - [L]

# For / serve index.html if it exists
RewriteCond %{REQUEST_URI} ^/$

RewriteCond    index.html -f

RewriteRule .? index.html [L]

# Otherwise use front controller
RewriteRule .? app.php [L]
Run Code Online (Sandbox Code Playgroud)

如果我注释掉 RewriteCond index.html -f 行,只要 index.html 确实存在,它就会起作用。但我也想检查 index.php,所以我需要检查文件是否存在。如果没有别的,我想了解为什么张贴的行不起作用。

regex apache .htaccess mod-rewrite

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

将加载器应用于特定文件

我正在关注http://alexomara.com/blog/webpack-and-jquery-include-only-the-parts-you-need使用webpack捆绑部分jQuery.

// webpack.config.js
module.exports = {
    entry: './entry',
    output: {
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            { 
                test: /jquery\/src\/selector\.js$/, 
                loader: 'amd-define-factory-patcher-loader' 
            }
        ]
    }
};
Run Code Online (Sandbox Code Playgroud)

事实证明,node_modules/jquery/src/selector.js由于AMD问题需要它自己的加载器.但是没有应用装载机.我在windows下运行,也许regexp需要调整?我试过不同的表情,但没有运气.

有关如何调试的任何建议?webpack新手.

正如所建议的,我补充说:

profile: true,
stats: {
  reasons: true,
  chunkModules: true,
  chunkOrigins: true,
  modules: true,
  cached: true,
  cachedAssets: true,
  source: true,
  errorDetails: true,
  publicPath: true,
  excludeModules: [
    /e\.js/
  ]
Run Code Online (Sandbox Code Playgroud)

运行webpack --display-modules收益率

Hash: 4a092c0d4d9e158a9bd7
Version: webpack 1.10.1
Time: 970ms
    Asset    Size  Chunks             Chunk Names
   bundle.js  876 kB       0  [emitted] …
Run Code Online (Sandbox Code Playgroud)

javascript webpack

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

标签 统计

.htaccess ×1

apache ×1

javascript ×1

mod-rewrite ×1

regex ×1

webpack ×1