나는 Angular With Webpack에 대한 강의를 진행 중입니다.
적은 로더을 추가하려고하는데 오류가 계속 발생합니다.webpack 및 es6에서 LESS를 사용합니다.
ERROR in ./src/app.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style.less in D:\projects\dev\webpack-angular-demo/src
@ ./src/app.js 3:0-24
내 webpack.config.js
입니다 : 내 이 app.js
module.exports = {
context: __dirname + '/src',
entry:'./app.js',
module:{
loaders:[
{
//create working environment for es6 need to npm i babel-loader babel-core babel-preset-es2015 -D
//https://github.com/babel/babel-loader
test:/\.js$/,
exclude:'/node_modules',
loader:'babel',
query: {
presets: ['es2015']
}
},
{
//take less convert to css and inject to style tag need to: npm i css-loader less-loader less style-loader -D
//https://github.com/webpack/less-loader
test:/\.less$/,
exclude:'/node_modules',
loader:"style!css!less"
}
]
}
};
입니다 : 내가 가지고있는 SRC 디렉토리 내부
import '../style.less';
class Log{
constructor(){
console.log("sdfsdf");
}
}
new Log();
app.js, index.html 및 스타일 적은 파일.
{
"name": "webpack-angular-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"css-loader": "^0.23.1",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"style-loader": "^0.13.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
}
}
내가이 오류를 받고 있어요 왜 어떤 생각 :
마지막으로,이 내 package.json 파일입니다? 모든 파일을 같은 디렉토리 (src
)에있는 경우
감사
그게 다야! 고마워. 나는 '왜'를 찾으려고 노력할 것이다. tnx – gilad