Skip to content

Instantly share code, notes, and snippets.

@myuon
Last active July 7, 2018 08:25
Show Gist options
  • Save myuon/fa551112ffda833aa2bfaf60fd6a1ff8 to your computer and use it in GitHub Desktop.
Save myuon/fa551112ffda833aa2bfaf60fd6a1ff8 to your computer and use it in GitHub Desktop.
~$ tree -L 1
.
├── cubism-js
├── dist
├── node_modules
├── package-lock.json
├── package.json
├── src
└── tsc
└── main.ts
├── tsconfig.json
└── webpack.config.js
~$ npm run build
> [email protected] build /home/ioijoi/program/juniQ
> webpack
Hash: 8ddd79ba29a55ef0b4f9
Version: webpack 4.15.1
Time: 2363ms
Built at: 2018-07-07 01:24:47
Asset Size Chunks Chunk Names
main.js 1.37 MiB main [emitted] main
main.js.map 1.55 MiB main [emitted] main
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {main} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
[./src/tsc/main.ts] 515 bytes {main} [built] [1 error]
+ 189 hidden modules
ERROR in ./src/tsc/main.ts
Module not found: Error: Can't resolve '../../cubism-js/src/live2dcubismcore' in '/home/ioijoi/program/juniQ/src/tsc'
@ ./src/tsc/main.ts 5:23-70
ERROR in /home/ioijoi/program/juniQ/src/tsc/main.ts
./src/tsc/main.ts
[tsl] ERROR in /home/ioijoi/program/juniQ/src/tsc/main.ts(2,35)
TS2306: File '/home/ioijoi/program/juniQ/cubism-js/src/live2dcubismcore.d.ts' is not a module.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ioijoi/.npm/_logs/2018-07-07T08_24_47_111Z-debug.log
import * as PIXI from 'pixi.js';
import * as LIVE2DCUBISMCORE from '../../cubism-js/src/live2dcubismcore';
// ここの時点でvscodeが
// [ts] File '../../cubism-js/src/live2dcubismcore' is not a module
// って怒ってくる
{
"name": "juniq",
"version": "1.0.0",
"description": "",
"main": "./src/tsc/main.ts",
"scripts": {
"build": "webpack"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@types/pixi.js": "^4.8.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"pixi.js": "^4.8.1",
"ts-loader": "^4.4.2",
"typescript": "^2.9.2",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8"
}
}
{
"compilerOptions": {
"sourceMap": false,
"target": "es5",
"module": "commonjs",
"moduleResolution": "classic",
"lib": [ "es2015", "dom" ],
"baseUrl": ".",
"paths": {
"*": [
"src/tsc/*",
"node_modules/*",
"./cubism-js/src/live2dcubismcore.d.ts"
]
}
}
}
var path = require('path');
module.exports = {
mode: 'development',
entry: './src/tsc/main.ts',
devtool: 'source-map',
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts$/,
use: [
{
loader: 'babel-loader',
options: { presets: ["env"] }
},
{
loader: 'ts-loader',
}
]
},
],
},
resolve: {
modules: [ 'src', 'node_modules' ],
extensions: [ '.ts', '.js' ]
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment