i-camp / tsukamoto-ar

MIT License
0 stars 0 forks source link

モジュール化 ar.jsをimportする時のエラー調査 #16

Closed okashitay closed 7 years ago

okashitay commented 7 years ago

import '../arjs/build/ar.js' で読み込ませて yarn run build すると

ERROR in ./arjs/build/ar.js
Module not found: Error: Can't resolve 'WebAR' in '/Users/okashitay/Yamaki/tsukamoto-ar/arjs/build'
 @ ./arjs/build/ar.js 843:67-92

となる

yarn run build --display-error-details してみる

ERROR in ./arjs/build/ar.js
Module not found: Error: Can't resolve 'fs' in '/Users/okashitay/Yamaki/tsukamoto-ar/arjs/build'
resolve 'fs' in '/Users/okashitay/Yamaki/tsukamoto-ar/arjs/build'
  Parsed request is a module
  using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./arjs/build)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./arjs/build)
    resolve as module
      /Users/okashitay/Yamaki/tsukamoto-ar/arjs/build/node_modules doesn't exist or is not a directory
      /Users/okashitay/Yamaki/tsukamoto-ar/arjs/build/src doesn't exist or is not a directory
      /Users/okashitay/Yamaki/tsukamoto-ar/arjs/node_modules doesn't exist or is not a directory
      /Users/okashitay/Yamaki/node_modules doesn't exist or is not a directory
      /Users/okashitay/Yamaki/src doesn't exist or is not a directory
      /Users/okashitay/node_modules doesn't exist or is not a directory
      /Users/okashitay/src doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /Users/src doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      /src doesn't exist or is not a directory
      looking for modules in /Users/okashitay/Yamaki/tsukamoto-ar/node_modules
        using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./node_modules)
          using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./node_modules/fs)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs.js doesn't exist
            .html
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs.html doesn't exist
            as directory
              /Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs doesn't exist
      looking for modules in /Users/okashitay/Yamaki/tsukamoto-ar/src
        using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./src)
          using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./src/fs)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/src/fs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/src/fs.js doesn't exist
            .html
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/src/fs.html doesn't exist
            as directory
              /Users/okashitay/Yamaki/tsukamoto-ar/src/fs doesn't exist
      looking for modules in /Users/okashitay/Yamaki/tsukamoto-ar/arjs/src
        using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./arjs/src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./arjs/src)
          using description file: /Users/okashitay/Yamaki/tsukamoto-ar/package.json (relative path: ./arjs/src/fs)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs.js doesn't exist
            .html
              Field 'browser' doesn't contain a valid alias configuration
              /Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs.html doesn't exist
            as directory
              /Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs doesn't exist
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/build/node_modules]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/build/src]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/node_modules]
[/Users/okashitay/Yamaki/node_modules]
[/Users/okashitay/Yamaki/src]
[/Users/okashitay/node_modules]
[/Users/okashitay/src]
[/Users/node_modules]
[/Users/src]
[/node_modules]
[/src]
[/Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs]
[/Users/okashitay/Yamaki/tsukamoto-ar/src/fs]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs]
[/Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs.js]
[/Users/okashitay/Yamaki/tsukamoto-ar/src/fs.js]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs.js]
[/Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs.html]
[/Users/okashitay/Yamaki/tsukamoto-ar/src/fs.html]
[/Users/okashitay/Yamaki/tsukamoto-ar/node_modules/fs]
[/Users/okashitay/Yamaki/tsukamoto-ar/src/fs]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs.html]
[/Users/okashitay/Yamaki/tsukamoto-ar/arjs/src/fs]
 @ ./arjs/build/ar.js 1:21468-21481 1:203456-203469
 @ ./src/ModuleAR.js
 @ ./src/main.js
 @ multi ./src/main.js
error Command failed with exit code 2.
okashitay commented 7 years ago

モジュール化はあきらめスクリプトを外部ファイルにすることに決定