Skip to content

Get many error about namespace 'ReactUWP' in webpack #36

@pboymt

Description

@pboymt

Problem description

Link to minimal working code that reproduces the issue

Versions

  • React-UWP: v1.1.8
  • React: 16.2.0
  • Browser: Electron(Chrome)

My tsconfig.json:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "jsx": "react",
    "sourceMap": true,
    "outDir": "./dist/",
    "strict": true, 
    "noImplicitAny": true,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "filesGlob": [
      "**/*.ts",
      "**/*.tsx"
    ],
    "files": [
      "./node_modules/react-uwp/index.d.ts"
    ]
  },
  "include": [
    "./src/**/*"
  ]
}

My webpack.config.js

module.exports = {
    entry: "./src/index.tsx",
    output: {
        filename: "bundle.js",
        path: __dirname + "/dist"
    },

    // Enable sourcemaps for debugging webpack's output.
    devtool: "source-map",
    target: "electron-renderer",

    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".ts", ".tsx", ".js", ".json"]
    },

    module: {
        rules: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            {
                test: /\.tsx?$/,
                loader: "awesome-typescript-loader"
            },

            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            {
                enforce: "pre",
                test: /\.js$/,
                loader: "source-map-loader"
            },
            {
                test: /\.css$/,
                loader: "css-loader"
            },
            {
                test: /\.scss$/,
                use: [{
                    loader: "style-loader" // creates style nodes from JS strings 
                }, {
                    loader: "css-loader" // translates CSS into CommonJS 
                }, {
                    loader: "sass-loader" // compiles Sass to CSS 
                }]
                // loader: ExtractTextPlugin.extract("style", 'css!sass')
            }
        ]
    },

    // When importing a module whose path matches one of the following, just
    // assume a corresponding global variable exists and use that instead.
    // This is important because it allows us to avoid bundling all of our
    // dependencies, which allows browsers to cache those libraries between builds.
    // externals: {
    //     "react": "React",
    //     "react-dom": "ReactDOM"
    // },
};

Error in compile:


[at-loader] Using typescript@2.6.2 from typescript and "tsconfig.json" from E:\node\react-start/tsconfig.json.


[at-loader] Checking started in a separate process...
Hash: 05b497a214cabf9f5d1b
Version: webpack 3.10.0
Time: 6365ms
        Asset     Size  Chunks                    Chunk Names
    bundle.js   997 kB       0  [emitted]  [big]  main
bundle.js.map  1.13 MB       0  [emitted]         main
  [28] ./src/index.tsx 337 bytes {0} [built]
  [39] ./src/Test.tsx 807 bytes {0} [built]
  [52] (webpack)/buildin/amd-define.js 88 bytes {0} [built]
    + 89 hidden modules

WARNING in ./node_modules/react-uwp/styles/fonts/segoe-mdl2-assets/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../../src/styles/fonts/segoe-mdl2-assets/index.ts': Error: Can't resolve '../../../../src/styles/fonts/segoe-mdl2-assets/index.ts' in 'E:\node\react-start\node_modules\react-uwp\styles\fonts\segoe-mdl2-assets'
 @ ./node_modules/react-uwp/Theme/index.js 40:26-70
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/nodeJS/IS_NODE_ENV.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../src/common/nodeJS/IS_NODE_ENV.ts': Error: Can't resolve '../../../src/common/nodeJS/IS_NODE_ENV.ts' in 'E:\node\react-start\node_modules\react-uwp\common\nodeJS'
 @ ./node_modules/react-uwp/Theme/index.js 41:20-59
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/react/isUnitlessNumber.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../src/common/react/isUnitlessNumber.ts': Error: Can't resolve '../../../src/common/react/isUnitlessNumber.ts' in 'E:\node\react-start\node_modules\react-uwp\common\react'
 @ ./node_modules/react-uwp/styles/StyleManager.js 14:25-68
 @ ./node_modules/react-uwp/Theme/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Button/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Button/index.tsx': Error: Can't resolve '../../src/Button/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Button'
 @ ./src/Test.tsx 6:17-44
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Icon/icons.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Icon/icons.ts': Error: Can't resolve '../../src/Icon/icons.ts' in 'E:\node\react-start\node_modules\react-uwp\Icon'
 @ ./node_modules/react-uwp/Icon/index.js 33:14-32
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Icon/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Icon/index.tsx': Error: Can't resolve '../../src/Icon/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Icon'
 @ ./node_modules/react-uwp/Button/index.js 33:13-31
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Theme/getBaseCSSText.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Theme/getBaseCSSText.tsx': Error: Can't resolve '../../src/Theme/getBaseCSSText.tsx' in 'E:\node\react-start\node_modules\react-uwp\Theme'
 @ ./node_modules/react-uwp/Theme/index.js 38:23-50
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Theme/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Theme/index.tsx': Error: Can't resolve '../../src/Theme/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Theme'
 @ ./src/Test.tsx 5:16-42
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Toast/ToastWrapper.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Toast/ToastWrapper.tsx': Error: Can't resolve '../../src/Toast/ToastWrapper.tsx' in 'E:\node\react-start\node_modules\react-uwp\Toast'
 @ ./node_modules/react-uwp/Theme/index.js 37:21-53
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Tooltip/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Tooltip/index.tsx': Error: Can't resolve '../../src/Tooltip/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Tooltip'
 @ ./node_modules/react-uwp/Button/index.js 34:16-37
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/prefixAll.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/prefixAll.ts': Error: Can't resolve '../../src/common/prefixAll.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/styles/getTheme.js 15:18-48
 @ ./node_modules/react-uwp/Theme/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/setStyleToElement.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/setStyleToElement.ts': Error: Can't resolve '../../src/common/setStyleToElement.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/ElementState.js 33:26-63
 @ ./node_modules/react-uwp/PseudoClasses.js
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/spreadObject.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/spreadObject.ts': Error: Can't resolve '../../src/common/spreadObject.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/PseudoClasses.js 34:21-53
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/StyleManager.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/StyleManager.ts': Error: Can't resolve '../../src/styles/StyleManager.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 32:21-54
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/darkTheme.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/darkTheme.ts': Error: Can't resolve '../../src/styles/darkTheme.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 33:18-48
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/generateAcrylicTexture.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/generateAcrylicTexture.ts': Error: Can't resolve '../../src/styles/generateAcrylicTexture.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 39:31-74
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/getTheme.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/getTheme.ts': Error: Can't resolve '../../src/styles/getTheme.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 34:17-46
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/ElementState.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/ElementState.tsx': Error: Can't resolve '../src/ElementState.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/PseudoClasses.js 33:21-46
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/PseudoClasses.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/PseudoClasses.tsx': Error: Can't resolve '../src/PseudoClasses.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/Button/index.js 32:22-49
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/RenderToBody.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/RenderToBody.tsx': Error: Can't resolve '../src/RenderToBody.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/Theme/index.js 36:21-47
 @ ./src/Test.tsx
 @ ./src/index.tsx

ERROR in [at-loader] ./node_modules/react-uwp/Button/index.d.ts:23:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:9:13 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:11:32 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:12:35 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:19:17 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:28:31 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:29:32 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:32:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:33:33 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:34:42 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:34:87 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:35:34 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:36:29 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:39:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:46:30 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:46:70 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:47:35 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:48:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:48:68 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:49:41 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Toast/ToastWrapper.d.ts:17:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:19:12 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:36:17 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:40:26 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:62:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:68:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/getTheme.d.ts:11:62 
    TS2503: Cannot find namespace 'ReactUWP'.

顺便问一句,我能说中文吗(英语捉急)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions