由于语法错误,BlueprintJS模块构建失败

时间:2017-07-18 18:02:28

标签: blueprintjs

运行npm run storybook时出现以下错误。 我几乎肯定是因为我的webpack.config或缺少的npm包中缺少了一些东西。

我已尽可能多地研究解决这个问题的方法/寻求解决方法,并希望得到帮助。

链接到我的示例Github repo https://github.com/hungrysquirrel/storybookv3/commit/85ba4e87ad7b27fbb3433a61c49da0fc254f528d

我启动服务器时在终端中可以看到的错误

ERROR in ./~/css-loader?{"importLoaders":1}!./~/postcss-loader/lib?{"ident":"postcss","plugins":[null,null]}!./~/@blueprintjs/core/dist/index.js
Module build failed: Syntax Error

(7:1) Unknown word

  5 |  * and https://github.com/palantir/blueprint/blob/master/PATENTS
  6 |  */
> 7 | "use strict";
    | ^
  8 | function __export(m) {
  9 |     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];

 @ ./~/css-loader?{"importLoaders":1}!./~/postcss-loader/lib?{"ident":"postcss"}!./css/global.css 3:10-151
 @ ./css/global.css
 @ ./stories/index.js
 @ ./.storybook/config.js
 @ multi ./~/@storybook/react/dist/server/config/polyfills.js ./~/@storybook/react/dist/server/config/globals.js (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js

ERROR in ./~/css-loader?{"importLoaders":1}!./~/postcss-loader/lib?{"ident":"postcss","plugins":[null,null]}!./~/@blueprintjs/table/src/table.scss
Module build failed: Syntax Error

(1:1) Unknown word

> 1 | // Copyright 2016 Palantir Technologies, Inc. All rights reserved.
    | ^
  2 | // Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy
  3 | // of the license at https://github.com/palantir/blueprint/blob/master/LICENSE

 @ ./~/css-loader?{"importLoaders":1}!./~/postcss-loader/lib?{"ident":"postcss"}!./css/global.css 4:10-167

2 个答案:

答案 0 :(得分:1)

我刚才有同样的问题。

我设法让它工作
    <{1}}中的
  • global.css
  • // replacing @import '~@blueprintjs/core'; // by the more explicit @import "~@blueprintjs/core/dist/blueprint.css"; 中的
  • 我包含了css和文件的加载器:

    webpack.config.js

答案 1 :(得分:1)

解决

  1. 包含.css文件中的scss文件 - BAD
  2. Webpack配置不正确。下面的设置解决了问题
  3. &#13;
    &#13;
    template <class /* Weird Hack Here */>
    struct object
    {
        constexpr object(int value, /* Other Weird Hack */) noexcept;
    };
    
    int main() 
    {
        object foo(1);
        object bar(1);
    }
    
    &#13;
    &#13;
    &#13;