문제 설명
그런트 작업 옵션을 이해하는 방법 (How to understand Grunt task options)
내 목표는 브라우저에서 ES6 코드를 실행하는 것인데, 많이 읽은 후에 여기에 링크 설명을 입력하세요
ES2015 코드를 실행할 수 있습니다. 하지만 Gruntfile.js를 만드는 데 어려움을 겪고 있습니다. 어떤 키워드를 사용할 수 있고 어떤 역할을 하는지 이해하지 못합니다. 예를 들어 browserify를 사용하면 다음과 같이 구성할 수 있습니다.
module.exports = function (grunt) {
grunt.initConfig({
browserify: {
dist: {
options: {
transform: [
["babelify", {
"presets":["es2015"]
}]
]
},
files: {
"./dist/module.js": ["./modules/index.js"]
}
}
},
});
grunt.loadNpmTasks("grunt‑browserify");
grunt.registerTask("default", ["browserify"]);
};
그런 다음 browserify 웹사이트로 이동합니다. 문서를 읽으려면 사전 설정
은 있지만 변환
은 없습니다. dist>options>transform을 중첩하고 presets</코드> 안에?
loose: "all"
을 사용할 수 있나요? grunt를 이해하려고 할 때도 같은 질문입니다. 사람들이 dist
를 사용하는 이유는 cli용인가요(run grunt ‑‑target=dist)?
내가 바보처럼 들린다면 죄송합니다. 며칠 동안 그런트 옵션을 이해하는 데 어려움을 겪습니다.
참조 솔루션
방법 1:
It's just a naming conventions for folders like in java we have
- dist is the folder where your generated archives are stored (so it gets updated through clean and build).
- build folder contains compiled classes and resources, but not the compressed archives.
(by Maxi Wu、Suraj Rawat)
참조 문서