在文件加载器中提供名称选项的主机名中断编译

时间:2018-05-24 20:09:38

标签: webpack

构建编译不起作用:

 λ npm run build

> typescript-sass-modules@0.1.0 build C:\Users\cypri\projets\typescript-sass-modules-boilerplate
> node scripts/build.js

Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
ts-loader: Using typescript@2.8.1 and C:\Users\cypri\projets\typescript-sass-modules-boilerplate\tsconfig.json
No valid rules have been specified 

坚持到这里。

如何重现:

将文件加载器添加到webpack.config.prod.js,如下所示:

{ 
    loader: require.resolve('file-loader'),
    exclude: [/\.js$/, /\.html$/, /\.json$/],
    options: { 
         name: 'http://test-vad/build/static/media/[name].[hash:8].[ext]'
    }
},

预期行为:

构建工作,主机名前置于文件网址

注意:删除主机名有效,它与错误“没有指定有效规则”无关,因为我在构建工作时也有它。

其他相关信息:

  • webpack版本:3.8.1

  • Node.js版本:8.11.2

  • 操作系统:win10

1 个答案:

答案 0 :(得分:0)

通过将PUBLIC_URL设置为.env:

解决了问题

see advanced configuration

相关问题